Skip to content

Commit 301a1d2

Browse files
committed
Merge branch 'main' into solid-three-next
2 parents d6881cd + 1cbc345 commit 301a1d2

149 files changed

Lines changed: 7017 additions & 4875 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/desktop.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
matrix:
2222
arch: [intel, arm64]
2323

24-
# macos-13 is an Intel image, apparently, whereas macos-latest is the latest Arm64
25-
runs-on: ${{ matrix.arch == 'intel' && 'macos-13' || 'macos-latest' }}
24+
# macos-15 is an Intel image, apparently, whereas macos-latest is the latest Arm64
25+
runs-on: ${{ matrix.arch == 'intel' && 'macos-15' || 'macos-latest' }}
2626

2727
# Steps represent a sequence of tasks that will be executed as part of the job
2828
steps:

.github/workflows/website.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
# separate terms of service, privacy policy, and support
44
# documentation.
55

6-
# building and deploying a Jekyll site to GitHub Pages
6+
# building and deploying an 11ty site to Dreamhost
77
name: vZome website
88

99
on:
10-
# Runs on pushes targeting the default branch, changing "docs"
10+
# Runs on pushes targeting the default branch, changing "website"
1111
push:
12+
# TODO: change to main when ready
1213
branches: ["main"]
1314
paths:
1415
- 'website/**'
@@ -38,23 +39,30 @@ jobs:
3839
uses: actions/checkout@v4
3940
with:
4041
lfs: 'true'
41-
- name: Setup Ruby
42-
# https://github.com/ruby/setup-ruby/releases/tag/v1.207.0
43-
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4
42+
43+
- name: Checkout nested repo
44+
uses: actions/checkout@v4
45+
with:
46+
repository: vorth/vzome-sharing
47+
path: website/vzome-sharing
48+
ref: 11ty-build
49+
token: ${{ secrets.GITHUB_TOKEN }} # Use PAT if private repo
50+
51+
- name: Setup Node.js
52+
uses: actions/setup-node@v4
4453
with:
45-
ruby-version: '3.1' # Not needed with a .ruby-version file
46-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
47-
cache-version: 0 # Increment this number if you need to re-download cached gems
48-
working-directory: website
49-
- name: Build with Jekyll
54+
node-version: '22' # or whatever version you're using
55+
56+
- name: Enable Corepack
57+
run: corepack enable
58+
59+
- name: Build with 11ty
5060
# Outputs to the './_site' directory by default
5161
run: |
5262
cd website
53-
pwd
54-
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
63+
yarn install
64+
IMAGES_URL=https://pub-72dcd7653cf3451d9ef0ad02dda76a89.r2.dev yarn exec eleventy
5565
find _site
56-
env:
57-
JEKYLL_ENV: production
5866
5967
- name: Configure SSH
6068
run: |
@@ -75,7 +83,7 @@ jobs:
7583
- name: Publish website to DreamHost
7684
run: |
7785
sftp -b - dreamhost <<END
78-
cd vzome.com/
86+
cd vzome.com
7987
put -r ./website/_site/* .
8088
END
8189

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,7 @@ core/failures.xml
9393
website/Gemfile.lock
9494

9595
website/docs/assets/
96+
website/scrape/
97+
website/.yalc/
98+
website/_site/
99+
website/vzome-sharing/

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"name": "debug desktop vZome",
1616
"type": "java",
1717
"request": "launch",
18-
"mainClass": "org.vorthmann.zome.ui.ApplicationUI",
19-
"args": "${command:SpecifyProgramArgs}"
18+
"mainClass": "org.vorthmann.zome.ui.ApplicationUI"
19+
// "args": "${command:SpecifyProgramArgs}"
2020
},
2121
{
2222
"name": "classic PWA",

cicd/jsweet-legacy-code.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ banner 'Transpiling core Java sources with JSweet' #############################
2424
./gradlew --continue -p online coreClean core &> core-errors.txt # ignore the exit code, it always fails
2525
cat core-errors.txt
2626

27-
grep -q 'transpilation failed with 35 error(s) and 0 warning(s)' core-errors.txt \
27+
grep -q 'transpilation failed with 27 error(s) and 0 warning(s)' core-errors.txt \
2828
&& banner 'JSweet core transpile found the expected errors' \
2929
|| { banner 'UNEXPECTED CHANGE IN JSWEET CORE ERRORS'; exit 1; }
3030

core/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ task regression(type: JavaExec, dependsOn: check) {
313313
if( project .hasProperty( "regressionOutput" ) ){
314314
testOut = regressionOutput
315315
}
316+
println 'Output directory is ' + regressionOutputDir.getAbsolutePath()
316317
println "testOut is $testOut"
317318
classpath = sourceSets.regression.runtimeClasspath
318319
main = 'com.vzome.core.regression.TestVZomeFiles'

core/src/main/java/com/vzome/core/algebra/AbstractAlgebraicField.java

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public String getIrrational( int i )
148148
// Eclipse says that rawtypes is unnecessary here, but without it,
149149
// Netbeans and the gradle command line both generate the rawtypes warning
150150
@SuppressWarnings({"unchecked", "rawtypes"})
151-
public AbstractAlgebraicField( String name, int order, AlgebraicNumberFactory factory )
151+
public AbstractAlgebraicField( String name, int order, AlgebraicNumberFactory factory )
152152
{
153153
this.name = name;
154154
this.order = order;
@@ -291,38 +291,35 @@ public final AlgebraicNumber createAlgebraicNumber( int[] terms )
291291
}
292292

293293
/**
294-
* Generates an AlgebraicNumber from a "trailing divisor" int array representation.
295-
* @param trailingDivisorForm numerators trailed by a common denominator for all numerators
296-
* @return
294+
* TODO: BigInteger.longValue() may silently lose precision here.
295+
* That's why it's deprecated.
296+
* I'm going to live with that possibility for now to avoid the overhead
297+
* of calling a BigInt version of convertGoldenNumberPairs().
297298
*/
298-
@Override
299-
public final AlgebraicNumber createAlgebraicNumberFromTD( int[] trailingDivisorForm )
299+
@SuppressWarnings({"deprecation"})
300+
public final AlgebraicNumber createAlgebraicNumberFromTD( BigRational[] trailingDivisorForm )
300301
{
301302
int terms = trailingDivisorForm.length - 1;
302-
if ( terms == 2 && this.getOrder() > 2 ) {
303-
303+
if ( terms == 2 && this.getOrder() > 2 && this.getGoldenRatio() != null) {
304304
// Momentarily switch to rational pairs (not reduced), in order to call convertGoldenNumberPairs
305305
// [ a1, a2, d ] => [ a1, d, a2, d, ... aN, d ]
306306
long[] pairs = new long[ 2*terms ];
307-
int divisor = trailingDivisorForm[ terms ];
307+
308+
long divisor = trailingDivisorForm[ terms ].getNumerator() .longValue();
308309
for (int i = 0; i < terms; i++) {
309-
pairs[ 2*i + 0 ] = trailingDivisorForm[ i ];
310+
pairs[ 2*i + 0 ] = trailingDivisorForm[ i ].getNumerator() .longValue();
310311
pairs[ 2*i + 1 ] = divisor;
311312
}
312313

314+
// All of this is just so we can call convertGoldenNumberPairs with longs instead of BigIntegers
313315
pairs = this .convertGoldenNumberPairs( pairs );
314-
315-
// Now switch back. Since only zero-valued terms were introduced, we don't need to reduce the fractions.
316-
terms = pairs.length/2;
317-
trailingDivisorForm = new int[ terms + 1 ];
318-
trailingDivisorForm[ terms ] = (int) pairs[ 1 ];
319-
for ( int i = 0; i < pairs.length/2; i++ ) {
320-
trailingDivisorForm[ i ] = (int) pairs[ 2*i ];
321-
}
316+
317+
return this .numberFactory .createAlgebraicNumberFromPairs( this, pairs );
322318
}
319+
323320
return this.numberFactory .createAlgebraicNumberFromTD( this, trailingDivisorForm );
324321
}
325-
322+
326323
/**
327324
* Generates an AlgebraicNumber with the specified numerators,
328325
* all having a common denominator as specified.
@@ -339,14 +336,13 @@ public final AlgebraicNumber createAlgebraicNumber( int[] numerators, int denomi
339336
@Override
340337
public final AlgebraicNumber createAlgebraicNumber( int ones, int irrat, int denominator, int scalePower )
341338
{
342-
int[] factors = new int[ this .order + 1 ];
339+
int[] factors = new int[ this .order ];
343340
factors[ 0 ] = ones;
344341
factors[ 1 ] = irrat;
345-
for ( int i = 2; i < this .order; i++ ) {
342+
for ( int i = 2; i < factors.length; i++ ) {
346343
factors[ i ] = 0;
347344
}
348-
factors[ this .order ] = denominator;
349-
AlgebraicNumber result = this.numberFactory .createAlgebraicNumberFromTD( this, factors );
345+
AlgebraicNumber result = this.numberFactory .createAlgebraicNumber( this, factors, denominator );
350346
if ( scalePower != 0 ) {
351347
AlgebraicNumber multiplier = this .createPower( scalePower );
352348
return result .times( multiplier );
@@ -464,9 +460,14 @@ public final AlgebraicNumber getUnitTerm( int n )
464460
if ( n < 0 ) {
465461
return zero();
466462
}
467-
int[] factors = this .zero() .toTrailingDivisor(); // makes a copy
468-
factors[ n ] = factors[ factors.length - 1 ]; // copies the 1n denominator
469-
return this .numberFactory .createAlgebraicNumberFromTD( this, factors );
463+
int[] numerators = new int[getOrder()];
464+
// Initializing primitive arrays to 0 is automatic in Java,
465+
// but not in JavaScript, so in case the JSweet port needs it...
466+
for (int i = 0; i < numerators.length; i++) {
467+
numerators[i] = 0;
468+
}
469+
numerators[n] = 1;
470+
return this .numberFactory .createAlgebraicNumber(this, numerators, 1);
470471
}
471472

472473
/**
@@ -605,21 +606,21 @@ public AlgebraicVector createVector( int[][] nums )
605606
for (int i = 0; i < pairs.length; i++) {
606607
pairs[ i ] = nums[ c ][ i ];
607608
}
608-
if ( pairs.length == 4 && getOrder() > 2 ) {
609+
if ( pairs.length == 4 && getOrder() > 2 && this.getGoldenRatio() != null) {
609610
pairs = this .convertGoldenNumberPairs( pairs );
610611
}
611612
coords[c] = this.numberFactory .createAlgebraicNumberFromPairs( this, pairs );
612613
}
613614
return new AlgebraicVector( coords );
614615
}
615616

616-
@Override
617-
public AlgebraicVector createVectorFromTDs( int[][] nums )
617+
// createVectorFromTDs() is only used by ColoredMeshJson and SimpleMeshJson
618+
public AlgebraicVector createVectorFromTDs( BigRational[][] nums )
618619
{
619620
int dims = nums.length;
620621
AlgebraicNumber[] coords = new AlgebraicNumber[ dims ];
621622
for(int c = 0; c < coords.length; c++) {
622-
coords[c] = this.createAlgebraicNumberFromTD( nums[c] );
623+
coords[c] = this.createAlgebraicNumberFromTD( nums[c] );
623624
}
624625
return new AlgebraicVector( coords );
625626
}
@@ -768,11 +769,10 @@ public AlgebraicNumber parseLegacyNumber( String val )
768769
@Override
769770
public AlgebraicNumber parseVefNumber( String string, boolean isRational )
770771
{
771-
long[] pairs = new long[ this .getOrder() * 2 ];
772-
// The pairs array is pre-initialized with zeros since it's a native type (not Integer)
773-
// so we can simply set all of the denominators to 1.
774-
for ( int i = 1; i < pairs.length; i+=2 ) {
775-
pairs[ i ] = 1;
772+
String[] fractions = new String[ this .getOrder() ];
773+
// initialize all pairs to "0/1", in case the string provides fewer factors than the field order
774+
for ( int i = 0; i < this .getOrder(); i++ ) {
775+
fractions[ i ] = "0/1";
776776
}
777777
// if the field is declared as rational, then we won't allow the irrational syntax using parenthesis
778778
// if the field is NOT declared as rational, then we will still allow the rational format as shorthand with no parenthesis
@@ -788,33 +788,40 @@ public AlgebraicNumber parseVefNumber( String string, boolean isRational )
788788
// With an order 6 field, if only 2 factors are provided, "(3,-2)" must still be parsed into a 6 element array as {-2, 3, 0, 0, 0, 0}
789789
// Since VEF version 7 no longer requires that all factors be provided, we need to push the factors onto a stack
790790
// and pop them off to reverse the order as they are inserted into the begining of the factors array.
791-
Stack<Integer> numStack = new Stack<>();
792-
Stack<Integer> denomStack = new Stack<>();
791+
Stack<String> numStack = new Stack<>();
792+
Stack<String> denomStack = new Stack<>();
793793
while( tokens .hasMoreTokens() ) {
794794
if( numStack.size() >= this .getOrder() ) {
795795
throw new RuntimeException( "VEF format error: \"" + string + "\" has too many factors for " + this.getName() + " field" );
796796
}
797797
String[] parts = tokens .nextToken() .split( "/" );
798-
numStack .push( Integer .parseInt( parts[ 0 ] ) );
799-
denomStack .push( (parts.length > 1)? Integer .parseInt( parts[ 1 ] ) : 1 );
798+
numStack .push( parts[ 0 ] );
799+
denomStack .push( (parts.length > 1)? parts[ 1 ] : "1" );
800800
}
801801
int i = 0;
802802
while( ! numStack.empty() ) {
803-
pairs[ i++ ] = numStack .pop();
804-
pairs[ i++ ] = denomStack .pop();
803+
fractions[ i++ ] = numStack .pop() + "/" + denomStack .pop();
805804
}
806-
if ( i == 4 && getOrder() > 2 ) {
805+
if ( i == 2 && getOrder() > 2 && this.getGoldenRatio() != null) {
806+
String[][] fractionParts = new String[][] {
807+
fractions[0] .split( "/" ),
808+
fractions[1] .split( "/" )
809+
};
810+
long[] pairs = new long[] {
811+
Long.parseLong( fractionParts[0][0] ), Long.parseLong( fractionParts[0][1] ),
812+
Long.parseLong( fractionParts[1][0] ), Long.parseLong( fractionParts[1][1] )
813+
};
807814
pairs = this .convertGoldenNumberPairs( new long[] { pairs[0], pairs[1], pairs[2], pairs[3] } );
815+
return this .numberFactory .createAlgebraicNumberFromPairs( this, pairs );
808816
}
809817
}
810818
else {
811819
// format >= 7 supports the rational numeric format which expects no irrational factors,
812820
// so there are no parentheses or commas, but still allows the optional "/" if a denominator is specified.
813821
String[] parts = string .split( "/" );
814-
pairs[ 0 ] = Integer .parseInt( parts[ 0 ] );
815-
pairs[ 1 ] = (parts.length > 1)? Integer .parseInt( parts[ 1 ] ) : 1;
822+
fractions[ 0 ] = parts[ 0 ] + "/" + ((parts.length > 1)? parts[ 1 ] : "1");
816823
}
817-
return this.numberFactory .createAlgebraicNumberFromPairs( this, pairs );
824+
return this .parseNumber( String.join( " ", fractions ) );
818825
}
819826

820827
@Override
@@ -832,17 +839,12 @@ public AlgebraicNumber parseNumber( String nums )
832839
private AlgebraicNumber parseNumber( StringTokenizer tokens )
833840
{
834841
int order = this .getOrder();
835-
long[] pairs = new long[ order * 2 ];
842+
BigRational[] bigs = new BigRational[ order ];
836843
for ( int i = 0; i < order; i++ ) {
837844
String digit = tokens .nextToken();
838-
String[] parts = digit.split( "/" );
839-
pairs[ i * 2 ] = Long.parseLong( parts[ 0 ] );
840-
if ( parts.length > 1 )
841-
pairs[ i * 2 + 1 ] = Long.parseLong( parts[ 1 ] );
842-
else
843-
pairs[ i * 2 + 1 ] = 1;
845+
bigs[ i ] = this.numberFactory .parseBigRational( digit );
844846
}
845-
return this.numberFactory .createAlgebraicNumberFromPairs( this, pairs );
847+
return this.numberFactory .createAlgebraicNumberFromBRs( this, bigs );
846848
}
847849

848850
@Override

core/src/main/java/com/vzome/core/algebra/AlgebraicField.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ public interface Registry
4949
*/
5050
AlgebraicNumber createAlgebraicNumber( int[] terms );
5151

52-
/**
53-
* Generates an AlgebraicNumber from a "trailing divisor" int array representation.
54-
* @param trailingDivisorForm numerators trailed by a common denominator for all numerators
55-
* @return
56-
*/
57-
AlgebraicNumber createAlgebraicNumberFromTD( int[] trailingDivisorForm );
58-
5952
/**
6053
* Generates an AlgebraicNumber with the specified numerators,
6154
* all having a common denominator as specified.
@@ -165,17 +158,7 @@ public interface Registry
165158
* @return an AlgebraicVector
166159
*/
167160
AlgebraicVector createVector( int[][] nums );
168-
169-
/**
170-
*
171-
* @param nums nums is an array of integer arrays: One array of coordinate terms per dimension.
172-
* Each inner array is in "trailing divisor" form, to represent a rational AlgebraicNumber.
173-
* If the order of the field is N, each inner array will be of length N+1, with the last
174-
* element being the divisor.
175-
* @return
176-
*/
177-
AlgebraicVector createVectorFromTDs( int[][] nums );
178-
161+
179162
/**
180163
* Generates an AlgebraicVector with all AlgebraicNumber terms being integers (having unit denominators).
181164
* Contrast this with {@code createVector(int[][] nums)} which requires all denominators to be specified.

core/src/main/java/com/vzome/core/algebra/AlgebraicNumber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,5 @@ public interface Real {}
160160
*/
161161
public String toString( int format );
162162

163-
public int[] toTrailingDivisor();
163+
public String[] toTrailingDivisor();
164164
}

0 commit comments

Comments
 (0)