picrate 2.1.1-java → 2.1.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.mvn/extensions.xml +1 -1
- data/.mvn/wrapper/MavenWrapperDownloader.java +1 -1
- data/.mvn/wrapper/maven-wrapper.properties +2 -2
- data/CHANGELOG.md +3 -1
- data/README.md +1 -1
- data/docs/_posts/2018-05-06-install_jruby.md +3 -3
- data/docs/_posts/2020-05-11-getting_started_manjaro.md +19 -7
- data/lib/picrate.rb +2 -1
- data/lib/picrate/helper_methods.rb +1 -1
- data/lib/picrate/runner.rb +4 -4
- data/lib/picrate/version.rb +1 -1
- data/library/jcomplex/jcomplex.rb +1 -0
- data/mvnw +2 -2
- data/mvnw.cmd +2 -2
- data/picrate.gemspec +1 -1
- data/pom.rb +8 -7
- data/pom.xml +4 -4
- data/src/main/java/monkstone/complex/JComplex.java +252 -0
- data/vendors/Rakefile +30 -21
- data/vendors/geany.rb +3 -3
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e9ef3696c4eb0b3a488c7e25d30546ab03eae3a49e5220ec3d9cf4c862fddf3
|
4
|
+
data.tar.gz: 88f799089492e9507bbb09baa4e9634c335627fea27ec8adf22207cf4678de7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57be7c1825b5afe9fac52830070c97e04b18590d6db7d3ff099a83861e757eb7dfba02f1f9a3ad80c5e6b20c1ce73226a13be1ce3aefb3d6e66180af59d742d1
|
7
|
+
data.tar.gz: a94c876edf96da7f89939d0cb11e8ab09f74c03686c5f36eaeae90ea61c5dd44e23c9d7812d521a17215110534a722f4a20ee7c29f8dffc28a1af0b15eac21db
|
data/.mvn/extensions.xml
CHANGED
@@ -20,7 +20,7 @@ import java.util.Properties;
|
|
20
20
|
|
21
21
|
public class MavenWrapperDownloader {
|
22
22
|
|
23
|
-
private static final String WRAPPER_VERSION = "0.5.
|
23
|
+
private static final String WRAPPER_VERSION = "0.5.6";
|
24
24
|
/**
|
25
25
|
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
26
26
|
*/
|
@@ -1,2 +1,2 @@
|
|
1
|
-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.
|
2
|
-
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.
|
1
|
+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
|
2
|
+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
v2.1.
|
1
|
+
v2.1.2 Bump to JRuby-9.2.14.0
|
2
|
+
|
3
|
+
v2.1.1 Bump to JRuby-9.2.13.0, include examples using ruby `clamp` in place of processing `constrain`, update to video-2.0 release, add run instruction to help
|
2
4
|
|
3
5
|
v2.1.0 Refactor how we configure geany so we can use ENV['HOME'] rather hard code config file. Bump to JRuby-9.2.12.0, include Sam Pottingers July 2020 staging changes.
|
4
6
|
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Requires java to build (and jogl-2.4.0-rc jars), but uses a maven wrapper so you
|
|
19
19
|
```bash
|
20
20
|
cd PiCrate # or whatever you call it
|
21
21
|
rake # assumes an installed version of vanilla processing
|
22
|
-
jgem install picrate-2.1.
|
22
|
+
jgem install picrate-2.1.2-java.gem
|
23
23
|
|
24
24
|
```
|
25
25
|
To create a template sketch:-
|
@@ -14,7 +14,7 @@ Get the latest version from [http://jruby.org/download][download]
|
|
14
14
|
|
15
15
|
```bash
|
16
16
|
cd /opt
|
17
|
-
sudo tar xzvf /pathToDownload/jruby-bin-9.2.
|
17
|
+
sudo tar xzvf /pathToDownload/jruby-bin-9.2.14.0.tar.gz
|
18
18
|
```
|
19
19
|
|
20
20
|
Then use the excellent `update-alternatives` tool to provide symbolic links to `jruby`, `jgem`, `jirb` and `rake` especially if you haven't installed `mri` ruby.
|
@@ -38,9 +38,9 @@ export PATH="${PATH}:${GEM_PATH}/bin"
|
|
38
38
|
|
39
39
|
### Automated install using bash ###
|
40
40
|
|
41
|
-
The [picrate2_install.sh][bash] script currently installs jruby-9.2.
|
41
|
+
The [picrate2_install.sh][bash] script currently installs jruby-9.2.14.0 and picrate-2.1.2.
|
42
42
|
|
43
43
|
If you know better please post on wiki
|
44
44
|
|
45
|
-
[download]:"https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.2.
|
45
|
+
[download]:"https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.2.14.0/jruby-dist-9.2.14.0-bin.tar.gz"
|
46
46
|
[bash]:https://gist.github.com/monkstone/6ae9840d7b7008c177b4a9f589d14ec6
|
@@ -5,12 +5,20 @@ date: 2020-05-11 07:34:13
|
|
5
5
|
categories: PiCrate update
|
6
6
|
permalink: /getting_manjaro/
|
7
7
|
---
|
8
|
-
|
8
|
+
If Manjaro does not come with a pre-installed java, then the first step is to install a `jdk` the distro version (jdk14) should work.
|
9
9
|
|
10
10
|
```bash
|
11
|
-
|
11
|
+
sudo pacman -S jdk-openjdk # current distro version jdk14
|
12
12
|
```
|
13
|
+
You can also use pacman to install jruby
|
14
|
+
```bash
|
15
|
+
sudo pacman -S jruby # current version jruby-9.2.14.0
|
16
|
+
```
|
17
|
+
It is probably a good idea to create a local gem store (rather needing to use sudo to install gems)
|
13
18
|
|
19
|
+
```bash
|
20
|
+
mkdir -p ~/.gem/ruby/2.5.0 # current MRI version supported by jruby
|
21
|
+
```
|
14
22
|
Now set your `GEM_HOME`, `GEM_PATH` and amend your `PATH` as follows:-
|
15
23
|
|
16
24
|
```bash
|
@@ -19,16 +27,20 @@ echo "export GEM_PATH=\"\${HOME}/.gem/ruby/${MRI_RUBY}\"" >> ~/.bashrc
|
|
19
27
|
echo "export PATH=\"\${PATH}:\${GEM_PATH}/bin\"" >> ~/.bashrc
|
20
28
|
source ~/.bashrc # to update environment without re-logging in
|
21
29
|
```
|
22
|
-
Now should be ready to install `picrate` and other gems.
|
23
|
-
|
30
|
+
Now should be ready to install `picrate` and other gems. But speed up install time you should set `--no-document` option in ~/.gemrc
|
31
|
+
|
24
32
|
```bash
|
25
|
-
|
33
|
+
touch ~/.gemrc
|
34
|
+
echo "gem: --no-document" > ~/.gemrc
|
26
35
|
```
|
27
36
|
To install latest picrate and its dependencies:-
|
28
37
|
|
29
38
|
```bash
|
30
39
|
jgem install picrate
|
31
40
|
```
|
41
|
+
|
42
|
+
Geany is a good editor/ide for PiCrate on the RaspberryPI (install via pacman), but some may prefer vim. For geany you should edit/preferences/Terminal to `Execute programs in the VTE`.
|
43
|
+
|
32
44
|
__For a first install:-__
|
33
45
|
|
34
46
|
```bash
|
@@ -37,7 +49,7 @@ picrate --install # no args, install samples and geany config
|
|
37
49
|
picrate -i Samples # to omit geany config
|
38
50
|
```
|
39
51
|
|
40
|
-
This installs example sketches in `~/projects/examples` and ties them into a `geany` project `examples.geany`. It should also be possible to run sketches from the `geany` ide.
|
52
|
+
This installs example sketches in `~/projects/examples` and ties them into a `geany` project `examples.geany`. It should also be possible to run sketches from the `geany` ide. The geany config creates `picrate.rb` template sketch so you can create a new sketch with template.
|
41
53
|
|
42
54
|
To create a template sketch from the command line:-
|
43
55
|
|
@@ -77,7 +89,7 @@ vim my_sketch.rb
|
|
77
89
|
To run sketches from command line:-
|
78
90
|
|
79
91
|
```bash
|
80
|
-
jruby my_sketch.rb
|
92
|
+
jruby --dev my_sketch.rb
|
81
93
|
```
|
82
94
|
|
83
95
|
Or even `chmod +x my_sketch.rb` to make an executable script.
|
data/lib/picrate.rb
CHANGED
data/lib/picrate/runner.rb
CHANGED
@@ -32,7 +32,7 @@ module Processing
|
|
32
32
|
opt_parser = OptionParser.new do |opts|
|
33
33
|
# Set a banner, displayed at the top
|
34
34
|
# of the help screen.
|
35
|
-
opts.banner = 'Usage: picrate [options] [<
|
35
|
+
opts.banner = 'Usage: picrate [options] [<name>]'
|
36
36
|
|
37
37
|
# Define the options, and what they do
|
38
38
|
options[:version] = false
|
@@ -55,6 +55,8 @@ module Processing
|
|
55
55
|
# assumed to have this option.
|
56
56
|
opts.on_tail('-h', '--help', 'Display this screen') do
|
57
57
|
puts opts
|
58
|
+
puts ''
|
59
|
+
puts 'Run a sketch: jruby [--dev] [<sketch.rb>]'
|
58
60
|
exit
|
59
61
|
end
|
60
62
|
end
|
@@ -81,9 +83,7 @@ module Processing
|
|
81
83
|
library ||= 'new'
|
82
84
|
choice = library.downcase
|
83
85
|
case choice
|
84
|
-
when /sound/
|
85
|
-
warn 'The sound library is broken, try minim instead'
|
86
|
-
when /samples|video/
|
86
|
+
when /samples|sound|video/
|
87
87
|
system "cd #{PICRATE_ROOT}/vendors && rake install_#{choice}"
|
88
88
|
when /new/
|
89
89
|
# install samples and config geany
|
data/lib/picrate/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
java_import Java::MonkstoneComplex::JComplex
|
data/mvnw
CHANGED
@@ -212,9 +212,9 @@ else
|
|
212
212
|
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
213
213
|
fi
|
214
214
|
if [ -n "$MVNW_REPOURL" ]; then
|
215
|
-
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.
|
215
|
+
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
216
216
|
else
|
217
|
-
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.
|
217
|
+
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
218
218
|
fi
|
219
219
|
while IFS="=" read key value; do
|
220
220
|
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
data/mvnw.cmd
CHANGED
@@ -120,7 +120,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
|
120
120
|
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
121
121
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
122
122
|
|
123
|
-
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.
|
123
|
+
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
124
124
|
|
125
125
|
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
126
126
|
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
@@ -134,7 +134,7 @@ if exist %WRAPPER_JAR% (
|
|
134
134
|
)
|
135
135
|
) else (
|
136
136
|
if not "%MVNW_REPOURL%" == "" (
|
137
|
-
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.
|
137
|
+
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
138
138
|
)
|
139
139
|
if "%MVNW_VERBOSE%" == "true" (
|
140
140
|
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
data/picrate.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |gem|
|
|
30
30
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
31
31
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
32
32
|
gem.add_development_dependency 'minitest', '~> 5.10'
|
33
|
-
gem.
|
33
|
+
gem.add_runtime_dependency 'rake', '~> 13.0'
|
34
34
|
gem.add_runtime_dependency 'arcball', '~> 1.0', '>= 1.0.1'
|
35
35
|
gem.require_paths = ['lib']
|
36
36
|
gem.platform = 'java'
|
data/pom.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
project 'picrate', 'http://maven.apache.org' do
|
4
4
|
model_version '4.0.0'
|
5
|
-
id 'ruby-processing:picrate:2.1.
|
5
|
+
id 'ruby-processing:picrate:2.1.2'
|
6
6
|
packaging 'jar'
|
7
7
|
|
8
8
|
description 'An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.'
|
@@ -31,7 +31,7 @@ project 'picrate', 'http://maven.apache.org' do
|
|
31
31
|
'project.build.sourceEncoding' => 'utf-8',
|
32
32
|
'polyglot.dump.pom' => 'pom.xml')
|
33
33
|
|
34
|
-
pom 'org.jruby:jruby:9.2.
|
34
|
+
pom 'org.jruby:jruby:9.2.14.0'
|
35
35
|
jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
|
36
36
|
jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
|
37
37
|
jar 'org.processing:video:3.0.2'
|
@@ -47,11 +47,12 @@ overrides do
|
|
47
47
|
'links' => ['${processing.api}',
|
48
48
|
'${jruby.api}'])
|
49
49
|
plugin(:jar, '3.2.0',
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
'archive' => {
|
51
|
+
'manifestEntries' => {
|
52
|
+
'Automatic-Module-Name' => 'processing.core'
|
53
|
+
}
|
54
|
+
}
|
55
|
+
)
|
55
56
|
plugin :jdeps, '3.1.2' do
|
56
57
|
execute_goals 'jdkinternals', 'test-jdkinternals'
|
57
58
|
end
|
data/pom.xml
CHANGED
@@ -6,12 +6,12 @@ DO NOT MODIFIY - GENERATED CODE
|
|
6
6
|
|
7
7
|
|
8
8
|
-->
|
9
|
-
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
9
|
+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
10
10
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
11
11
|
<modelVersion>4.0.0</modelVersion>
|
12
12
|
<groupId>ruby-processing</groupId>
|
13
13
|
<artifactId>picrate</artifactId>
|
14
|
-
<version>2.1.
|
14
|
+
<version>2.1.2</version>
|
15
15
|
<name>picrate</name>
|
16
16
|
<description>An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.</description>
|
17
17
|
<url>http://maven.apache.org</url>
|
@@ -76,7 +76,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
76
76
|
<dependency>
|
77
77
|
<groupId>org.jruby</groupId>
|
78
78
|
<artifactId>jruby</artifactId>
|
79
|
-
<version>9.2.
|
79
|
+
<version>9.2.14.0</version>
|
80
80
|
<type>pom</type>
|
81
81
|
</dependency>
|
82
82
|
<dependency>
|
@@ -149,7 +149,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
149
149
|
<configuration>
|
150
150
|
<archive>
|
151
151
|
<manifestEntries>
|
152
|
-
<
|
152
|
+
<Automatic-Module-Name>processing.core</Automatic-Module-Name>
|
153
153
|
</manifestEntries>
|
154
154
|
</archive>
|
155
155
|
</configuration>
|
@@ -0,0 +1,252 @@
|
|
1
|
+
package monkstone.complex;
|
2
|
+
|
3
|
+
import java.util.Objects;
|
4
|
+
|
5
|
+
/**
|
6
|
+
* The purpose of this class is to to make Complex operations more efficient
|
7
|
+
* than JRuby RubyComplex, by having a simpler interface, only modest
|
8
|
+
* improvements were obtained (but this is better than nothing on RaspberryPI).
|
9
|
+
*/
|
10
|
+
public final class JComplex {
|
11
|
+
|
12
|
+
private final double re; // the real part
|
13
|
+
private final double im; // the imaginary part
|
14
|
+
private final static JComplex ZERO = new JComplex(0, 0);
|
15
|
+
private final static JComplex NAN = new JComplex(Double.NaN, Double.NaN);
|
16
|
+
|
17
|
+
/**
|
18
|
+
* create a new object with the given real and imaginary parts
|
19
|
+
*
|
20
|
+
* @param real
|
21
|
+
* @param imag
|
22
|
+
*/
|
23
|
+
public JComplex(double real, double imag) {
|
24
|
+
re = real;
|
25
|
+
im = imag;
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* @return a string representation of the invoking Complex object
|
30
|
+
*/
|
31
|
+
@Override
|
32
|
+
public String toString() {
|
33
|
+
return "JComplex(" + re + ", " + im + "i)";
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
*
|
38
|
+
* @return abs/modulus/magnitude
|
39
|
+
*/
|
40
|
+
public final double abs() {
|
41
|
+
return Math.hypot(re, im);
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
*
|
46
|
+
* @return square of abs/modulus/magnitude
|
47
|
+
*/
|
48
|
+
public final double abs2() {
|
49
|
+
return re * re + im * im;
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
*
|
54
|
+
* @return angle/phase/argument, normalized to be between -pi and pi
|
55
|
+
*/
|
56
|
+
public final double phase() {
|
57
|
+
return Math.atan2(im, re);
|
58
|
+
}
|
59
|
+
|
60
|
+
/**
|
61
|
+
*
|
62
|
+
* @param b
|
63
|
+
* @return a new Complex object whose value is (this + b)
|
64
|
+
*/
|
65
|
+
public final JComplex add(JComplex b) {
|
66
|
+
JComplex a = this; // invoking object
|
67
|
+
double real = a.re + b.re;
|
68
|
+
double imag = a.im + b.im;
|
69
|
+
return new JComplex(real, imag);
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
*
|
74
|
+
* @param scalar
|
75
|
+
* @return a new Complex object whose value is (this + scalar)
|
76
|
+
*/
|
77
|
+
public final JComplex add(double scalar) {
|
78
|
+
return new JComplex(re + scalar, im);
|
79
|
+
}
|
80
|
+
|
81
|
+
public final boolean zero() {
|
82
|
+
return this.equals(ZERO);
|
83
|
+
}
|
84
|
+
|
85
|
+
/**
|
86
|
+
*
|
87
|
+
* @param b
|
88
|
+
* @return a new Complex object whose value is (this - b)
|
89
|
+
*/
|
90
|
+
public final JComplex sub(JComplex b) {
|
91
|
+
JComplex a = this;
|
92
|
+
double real = a.re - b.re;
|
93
|
+
double imag = a.im - b.im;
|
94
|
+
return new JComplex(real, imag);
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
*
|
99
|
+
* @param scalar
|
100
|
+
* @return a new Complex object whose value is (this - scalar)
|
101
|
+
*/
|
102
|
+
public final JComplex sub(double scalar) {
|
103
|
+
return new JComplex(re - scalar, im);
|
104
|
+
}
|
105
|
+
|
106
|
+
/**
|
107
|
+
*
|
108
|
+
* @param b
|
109
|
+
* @return a new Complex object whose value is (this * b)
|
110
|
+
*/
|
111
|
+
public final JComplex mul(JComplex b) {
|
112
|
+
JComplex a = this;
|
113
|
+
double real = a.re * b.re - a.im * b.im;
|
114
|
+
double imag = a.re * b.im + a.im * b.re;
|
115
|
+
return new JComplex(real, imag);
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Also known as scale
|
120
|
+
*
|
121
|
+
* @param b
|
122
|
+
* @return a new Complex object whose value is (this * b)
|
123
|
+
*/
|
124
|
+
public final JComplex mul(double b) {
|
125
|
+
return new JComplex(re * b, im * b);
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
*
|
130
|
+
* @return a new Complex object whose value is the conjugate of this
|
131
|
+
*/
|
132
|
+
public final JComplex conjugate() {
|
133
|
+
return new JComplex(re, -im);
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
*
|
138
|
+
* @return a new Complex object whose value is the reciprocal of this
|
139
|
+
*/
|
140
|
+
private JComplex reciprocal() {
|
141
|
+
double scale = re * re + im * im; // self dot product
|
142
|
+
return new JComplex(re / scale, -im / scale);
|
143
|
+
}
|
144
|
+
|
145
|
+
/**
|
146
|
+
*
|
147
|
+
* @param other
|
148
|
+
* @return this^other
|
149
|
+
*/
|
150
|
+
public final JComplex pow(JComplex other) {
|
151
|
+
if (this.zero()) {
|
152
|
+
if (other.zero()) {
|
153
|
+
return ZERO;
|
154
|
+
}
|
155
|
+
return NAN;
|
156
|
+
}
|
157
|
+
return (this).log().mul(other).exp();
|
158
|
+
}
|
159
|
+
|
160
|
+
/**
|
161
|
+
*
|
162
|
+
* @param scalar
|
163
|
+
* @return this^scalar
|
164
|
+
*/
|
165
|
+
public final JComplex pow(double scalar) {
|
166
|
+
if (this.zero()) {
|
167
|
+
if (scalar == 0) {
|
168
|
+
return ZERO;
|
169
|
+
}
|
170
|
+
return NAN;
|
171
|
+
}
|
172
|
+
return (this).log().mul(scalar).exp();
|
173
|
+
}
|
174
|
+
|
175
|
+
/**
|
176
|
+
*
|
177
|
+
* @return log
|
178
|
+
*/
|
179
|
+
private JComplex log() {
|
180
|
+
return new JComplex(Math.log(abs()), Math.atan2(im, re));
|
181
|
+
}
|
182
|
+
|
183
|
+
/**
|
184
|
+
*
|
185
|
+
* @return real part
|
186
|
+
*/
|
187
|
+
public final double re() {
|
188
|
+
return re;
|
189
|
+
}
|
190
|
+
|
191
|
+
/**
|
192
|
+
*
|
193
|
+
* @return imaginary part
|
194
|
+
*/
|
195
|
+
public final double im() {
|
196
|
+
return im;
|
197
|
+
}
|
198
|
+
|
199
|
+
/**
|
200
|
+
*
|
201
|
+
* @param b
|
202
|
+
* @return a / b
|
203
|
+
*/
|
204
|
+
public final JComplex div(JComplex b) {
|
205
|
+
JComplex a = this;
|
206
|
+
return a.mul(b.reciprocal());
|
207
|
+
}
|
208
|
+
|
209
|
+
/**
|
210
|
+
*
|
211
|
+
* @param b
|
212
|
+
* @return a / b
|
213
|
+
*/
|
214
|
+
public final JComplex div(double b) {
|
215
|
+
if (b == 0) {
|
216
|
+
return NAN;
|
217
|
+
}
|
218
|
+
return new JComplex(re / b, im / b);
|
219
|
+
}
|
220
|
+
|
221
|
+
/**
|
222
|
+
*
|
223
|
+
* @return a new Complex object whose value is the complex exponential of
|
224
|
+
* this
|
225
|
+
*/
|
226
|
+
public final JComplex exp() {
|
227
|
+
return new JComplex(Math.exp(re) * Math.cos(im), Math.exp(re) * Math.sin(im));
|
228
|
+
}
|
229
|
+
|
230
|
+
@Override
|
231
|
+
public final int hashCode() {
|
232
|
+
return Objects.hash(re, im);
|
233
|
+
}
|
234
|
+
|
235
|
+
@Override
|
236
|
+
public final boolean equals(Object obj) {
|
237
|
+
if (this == obj) {
|
238
|
+
return true;
|
239
|
+
}
|
240
|
+
if (obj == null) {
|
241
|
+
return false;
|
242
|
+
}
|
243
|
+
if (getClass() != obj.getClass()) {
|
244
|
+
return false;
|
245
|
+
}
|
246
|
+
final JComplex other = (JComplex) obj;
|
247
|
+
if (Double.doubleToLongBits(this.re) != Double.doubleToLongBits(other.re)) {
|
248
|
+
return false;
|
249
|
+
}
|
250
|
+
return Double.doubleToLongBits(this.im) == Double.doubleToLongBits(other.im);
|
251
|
+
}
|
252
|
+
}
|
data/vendors/Rakefile
CHANGED
@@ -5,9 +5,9 @@ require 'rake/clean'
|
|
5
5
|
require_relative './geany'
|
6
6
|
WARNING = 'WARNING: wget download failed you could do a manual download'
|
7
7
|
SOUND = 'sound.zip'
|
8
|
-
|
9
|
-
VIDEO = 'video
|
10
|
-
|
8
|
+
PROCESSING_GITHUB = 'https://github.com/processing'
|
9
|
+
VIDEO = 'video.zip'
|
10
|
+
DOWNLOAD = 'releases/download/latest'
|
11
11
|
EXAMPLES = '0.5.5'
|
12
12
|
HOME_DIR = ENV['HOME']
|
13
13
|
LIBRARY = File.join(HOME_DIR, '.picrate', 'libraries')
|
@@ -47,16 +47,24 @@ task download_samples: ["#{EXAMPLES}.tar.gz"]
|
|
47
47
|
|
48
48
|
desc 'download sound library'
|
49
49
|
task :download_sound do
|
50
|
-
wget_base = 'wget
|
51
|
-
wget_string = [wget_base, '
|
52
|
-
|
50
|
+
wget_base = ['wget', PROCESSING_GITHUB].join(' ')
|
51
|
+
wget_string = [wget_base, 'processing-sound', DOWNLOAD, SOUND].join('/')
|
52
|
+
begin
|
53
|
+
sh wget_string
|
54
|
+
rescue StandardError
|
55
|
+
warn(WARNING)
|
56
|
+
end
|
53
57
|
end
|
54
58
|
|
55
59
|
desc 'download video library'
|
56
60
|
task :download_video do
|
57
|
-
wget_base = 'wget
|
58
|
-
wget_string = [wget_base, '
|
59
|
-
|
61
|
+
wget_base = ['wget', PROCESSING_GITHUB].join(' ')
|
62
|
+
wget_string = [wget_base, 'processing-video', DOWNLOAD, VIDEO].join('/')
|
63
|
+
begin
|
64
|
+
sh wget_string
|
65
|
+
rescue StandardError
|
66
|
+
warn(WARNING)
|
67
|
+
end
|
60
68
|
end
|
61
69
|
|
62
70
|
desc 'initialize ~/.picrate directories'
|
@@ -71,10 +79,10 @@ task :install_config do
|
|
71
79
|
FileUtils.cp 'picrate.rb', "#{HOME_DIR}/.config/geany/templates/files"
|
72
80
|
end
|
73
81
|
project_dir = File.join(HOME_DIR, 'projects')
|
74
|
-
unless File.exist? File.join(project_dir, '
|
75
|
-
FileUtils.mkdir_p "#{HOME_DIR}/projects
|
76
|
-
config = GeanyConfig.new(project_dir
|
77
|
-
config.save(File.join(project_dir, '
|
82
|
+
unless File.exist? File.join(project_dir, 'picrate_sketches.geany')
|
83
|
+
FileUtils.mkdir_p "#{HOME_DIR}/projects"
|
84
|
+
config = GeanyConfig.new(project_dir)
|
85
|
+
config.save(File.join(project_dir, 'picrate_sketches.geany'))
|
78
86
|
end
|
79
87
|
end
|
80
88
|
|
@@ -89,15 +97,16 @@ end
|
|
89
97
|
|
90
98
|
desc 'copy sound library'
|
91
99
|
task copy_sound: SOUND do
|
92
|
-
|
93
|
-
|
94
|
-
|
100
|
+
sh "unzip #{SOUND}"
|
101
|
+
sh "rm -r #{LIBRARY}/sound" if File.exist? "#{LIBRARY}/sound"
|
102
|
+
sh "cp -r sound #{LIBRARY}"
|
103
|
+
sh 'rm -r sound'
|
95
104
|
end
|
96
105
|
|
97
106
|
desc 'copy video library'
|
98
|
-
task copy_video:
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
107
|
+
task copy_video: VIDEO do
|
108
|
+
sh "unzip #{VIDEO}"
|
109
|
+
sh "rm -r #{LIBRARY}/video" if File.exist? "#{LIBRARY}/video"
|
110
|
+
sh "cp -r video #{LIBRARY}"
|
111
|
+
sh 'rm -r video'
|
103
112
|
end
|
data/vendors/geany.rb
CHANGED
@@ -25,7 +25,7 @@ indent_mode=2
|
|
25
25
|
|
26
26
|
[project]
|
27
27
|
name=picrate_samples
|
28
|
-
base_path
|
28
|
+
base_path=examples
|
29
29
|
description=Exploring PiCrate
|
30
30
|
file_patterns=*.rb;*.glsl;*.txt;
|
31
31
|
|
@@ -69,9 +69,9 @@ class GeanyConfig
|
|
69
69
|
include ERB::Util
|
70
70
|
attr_accessor :home, :directory, :template
|
71
71
|
|
72
|
-
def initialize(
|
72
|
+
def initialize(directory, template = geany_config)
|
73
73
|
@home = home
|
74
|
-
@directory =
|
74
|
+
@directory = directory
|
75
75
|
@template = template
|
76
76
|
end
|
77
77
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- monkstone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -29,15 +29,15 @@ dependencies:
|
|
29
29
|
requirements:
|
30
30
|
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '13.0'
|
33
33
|
name: rake
|
34
|
-
type: :
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
@@ -190,7 +190,7 @@ files:
|
|
190
190
|
- lib/jogl-all-natives-linux-amd64.jar
|
191
191
|
- lib/jogl-all-natives-linux-armv6hf.jar
|
192
192
|
- lib/jogl-all.jar
|
193
|
-
- lib/picrate-2.1.
|
193
|
+
- lib/picrate-2.1.2.jar
|
194
194
|
- lib/picrate.rb
|
195
195
|
- lib/picrate/app.rb
|
196
196
|
- lib/picrate/creators/parameters.rb
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- library/color_group/color_group.rb
|
210
210
|
- library/control_panel/control_panel.rb
|
211
211
|
- library/dxf/dxf.rb
|
212
|
+
- library/jcomplex/jcomplex.rb
|
212
213
|
- library/library_proxy/README.md
|
213
214
|
- library/library_proxy/library_proxy.rb
|
214
215
|
- library/net/net.rb
|
@@ -226,6 +227,7 @@ files:
|
|
226
227
|
- src/main/java/monkstone/ColorUtil.java
|
227
228
|
- src/main/java/monkstone/MathToolModule.java
|
228
229
|
- src/main/java/monkstone/PicrateLibrary.java
|
230
|
+
- src/main/java/monkstone/complex/JComplex.java
|
229
231
|
- src/main/java/monkstone/core/LibraryProxy.java
|
230
232
|
- src/main/java/monkstone/fastmath/Deglut.java
|
231
233
|
- src/main/java/monkstone/fastmath/package-info.java
|