xot 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/VERSION +1 -1
- data/include/xot/defs.h +3 -0
- data/include/xot/ref.h +5 -0
- data/include/xot/util.h +23 -0
- data/src/util.cpp +30 -0
- data/xot.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c91ff7087089082faf7e63799ae57afba9f61125
|
4
|
+
data.tar.gz: b063917ac96375cc7e84ae49b2b66414f5e2fd02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c607f74531a45cacc4e9ec184edfbc9727d397d65b63d4daba613599dec3e96ea713bd6fbb0f0e05be6a7de4bb364893d47718d14caa767cbc62e32e9944f24
|
7
|
+
data.tar.gz: fd6a798557ebcc20a22cd8d3351b25c5335ec72d0b393ec73aea46a02dc97cacab268dd1f0d1cd46e771ca3bf67c812c196343757ff386fb98b77c905c2fb76a
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
data/include/xot/defs.h
CHANGED
data/include/xot/ref.h
CHANGED
data/include/xot/util.h
CHANGED
@@ -5,6 +5,9 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
#include <stdint.h>
|
8
|
+
#include <math.h>
|
9
|
+
#include <xot/defs.h>
|
10
|
+
#include <xot/time.h>
|
8
11
|
|
9
12
|
|
10
13
|
namespace Xot
|
@@ -16,6 +19,26 @@ namespace Xot
|
|
16
19
|
int byte2bit (int bytes);
|
17
20
|
|
18
21
|
|
22
|
+
void seed (uint value = (uint) (time() * 1000));
|
23
|
+
|
24
|
+
double random (double max_ = 1);
|
25
|
+
|
26
|
+
double random (double min_, double max_);
|
27
|
+
|
28
|
+
|
29
|
+
template <typename T>
|
30
|
+
inline T deg2rad (T degree)
|
31
|
+
{
|
32
|
+
return degree / (T) 180 * M_PI;
|
33
|
+
}
|
34
|
+
|
35
|
+
template <typename T>
|
36
|
+
inline T rad2deg (T radian)
|
37
|
+
{
|
38
|
+
return radian / M_PI * (T) 180;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
19
42
|
template <typename T>
|
20
43
|
inline T clip (T minval, T maxval, T value)
|
21
44
|
{
|
data/src/util.cpp
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
#include "xot/util.h"
|
2
2
|
|
3
3
|
|
4
|
+
#include <stdlib.h>
|
5
|
+
|
6
|
+
|
4
7
|
namespace Xot
|
5
8
|
{
|
6
9
|
|
@@ -19,4 +22,31 @@ namespace Xot
|
|
19
22
|
}
|
20
23
|
|
21
24
|
|
25
|
+
static bool seeded = false;
|
26
|
+
|
27
|
+
void
|
28
|
+
seed (uint value)
|
29
|
+
{
|
30
|
+
srand(value);
|
31
|
+
seeded = true;
|
32
|
+
}
|
33
|
+
|
34
|
+
double
|
35
|
+
random (double max_)
|
36
|
+
{
|
37
|
+
return random(0, max_);
|
38
|
+
}
|
39
|
+
|
40
|
+
double
|
41
|
+
random (double min_, double max_)
|
42
|
+
{
|
43
|
+
if (!seeded) seed();
|
44
|
+
|
45
|
+
double n = (double) rand() / (double) RAND_MAX;
|
46
|
+
if (max_ != 1) n *= max_;
|
47
|
+
if (min_ != 0) n += min_;
|
48
|
+
return n;
|
49
|
+
}
|
50
|
+
|
51
|
+
|
22
52
|
}// Xot
|
data/xot.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
|
24
24
|
s.authors = %w[snori]
|
25
25
|
s.email = 'snori@xord.org'
|
26
|
-
s.homepage = "
|
26
|
+
s.homepage = "https://github.com/xord/spacy/wiki/#{name.capitalize}-Home"
|
27
27
|
|
28
28
|
s.platform = Gem::Platform::RUBY
|
29
29
|
s.required_ruby_version = '>=1.9.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- snori
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -89,7 +89,7 @@ files:
|
|
89
89
|
- test/test_setter.rb
|
90
90
|
- test/test_tester.rb
|
91
91
|
- xot.gemspec
|
92
|
-
homepage:
|
92
|
+
homepage: https://github.com/xord/spacy/wiki/Xot-Home
|
93
93
|
licenses: []
|
94
94
|
metadata: {}
|
95
95
|
post_install_message:
|