Skip to content

Commit 0017688

Browse files
committed
Added support for plasticPhi field in online vZome
I simply had not included the `PlasticPhiFieldApplication` in JSweet.
1 parent 68db759 commit 0017688

8 files changed

Lines changed: 364 additions & 13 deletions

File tree

online/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ core.config {
165165
'com/vzome/core/kinds/HeptagonFieldApplication.java',
166166
'com/vzome/core/kinds/SnubCubeFieldApplication.java',
167167
'com/vzome/core/kinds/SnubDodecFieldApplication.java',
168+
'com/vzome/core/kinds/PlasticPhiFieldApplication.java',
168169
'com/vzome/core/kinds/PolygonFieldApplication.java',
169170
'com/vzome/core/kinds/AbstractSymmetryPerspective.java',
170171
'com/vzome/core/kinds/OctahedralSymmetryPerspective.java',

online/src/worker/legacy/core-java.js

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21969,6 +21969,120 @@ export var com;
2196921969
})(core = vzome.core || (vzome.core = {}));
2197021970
})(vzome = com.vzome || (com.vzome = {}));
2197121971
})(com || (com = {}));
21972+
(function (com) {
21973+
var vzome;
21974+
(function (vzome) {
21975+
var core;
21976+
(function (core) {
21977+
var kinds;
21978+
(function (kinds) {
21979+
class PlasticPhiFieldApplication extends com.vzome.core.kinds.DefaultFieldApplication {
21980+
constructor(field) {
21981+
super(field);
21982+
if (this.icosahedralPerspective === undefined) {
21983+
this.icosahedralPerspective = null;
21984+
}
21985+
this.symmetryPerspectives = (new java.util.ArrayList());
21986+
if (this.H4 === undefined) {
21987+
this.H4 = null;
21988+
}
21989+
this.h4Builder = null;
21990+
this.icosahedralPerspective = new com.vzome.core.kinds.IcosahedralSymmetryPerspective(this.getField());
21991+
this.symmetryPerspectives.add(this.icosahedralPerspective);
21992+
this.symmetryPerspectives.add(super.getDefaultSymmetryPerspective());
21993+
this.H4 = new com.vzome.core.math.symmetry.QuaternionicSymmetry("H_4", "com/vzome/core/math/symmetry/H4roots.vef", this.getField());
21994+
}
21995+
/**
21996+
*
21997+
* @return {com.vzome.core.algebra.PlasticPhiField}
21998+
*/
21999+
getField() {
22000+
return super.getField();
22001+
}
22002+
/**
22003+
*
22004+
* @return {*}
22005+
*/
22006+
getSymmetryPerspectives() {
22007+
return this.symmetryPerspectives;
22008+
}
22009+
/**
22010+
*
22011+
* @return {*}
22012+
*/
22013+
getDefaultSymmetryPerspective() {
22014+
return this.icosahedralPerspective;
22015+
}
22016+
/**
22017+
*
22018+
* @param {string} symmName
22019+
* @return {*}
22020+
*/
22021+
getSymmetryPerspective(symmName) {
22022+
for (let index = this.symmetryPerspectives.iterator(); index.hasNext();) {
22023+
let sp = index.next();
22024+
{
22025+
if (sp.getName() === symmName) {
22026+
return sp;
22027+
}
22028+
}
22029+
}
22030+
return super.getSymmetryPerspective(symmName);
22031+
}
22032+
/**
22033+
*
22034+
* @param {*} toolFactories
22035+
* @param {com.vzome.core.editor.ToolsModel} tools
22036+
*/
22037+
registerToolFactories(toolFactories, tools) {
22038+
super.registerToolFactories(toolFactories, tools);
22039+
const symm = this.icosahedralPerspective.getSymmetry();
22040+
toolFactories.put("AxialStretchTool", new com.vzome.core.tools.AxialStretchTool.Factory(tools, symm, false, false, false));
22041+
toolFactories.put("SymmetryTool", new com.vzome.core.tools.IcosahedralToolFactory(tools, symm));
22042+
}
22043+
/**
22044+
*
22045+
* @param {string} name
22046+
* @return {com.vzome.core.math.symmetry.QuaternionicSymmetry}
22047+
*/
22048+
getQuaternionSymmetry(name) {
22049+
switch ((name)) {
22050+
case "H_4":
22051+
return this.H4;
22052+
default:
22053+
return null;
22054+
}
22055+
}
22056+
/**
22057+
*
22058+
* @param {string} groupName
22059+
* @param {number} index
22060+
* @param {number} edgesToRender
22061+
* @param {com.vzome.core.algebra.AlgebraicNumber[]} edgeScales
22062+
* @param {*} listener
22063+
*/
22064+
constructPolytope(groupName, index, edgesToRender, edgeScales, listener) {
22065+
switch ((groupName)) {
22066+
case "H4":
22067+
if (this.h4Builder == null) {
22068+
const qsymm = new com.vzome.core.math.symmetry.QuaternionicSymmetry("H_4", "com/vzome/core/math/symmetry/H4roots.vef", this.getField());
22069+
this.h4Builder = new com.vzome.core.commands.CommandUniformH4Polytope(this.getField(), qsymm, 0);
22070+
}
22071+
this.h4Builder.generate(index, edgesToRender, edgeScales, listener);
22072+
break;
22073+
default:
22074+
super.constructPolytope(groupName, index, edgesToRender, edgeScales, listener);
22075+
break;
22076+
}
22077+
}
22078+
}
22079+
kinds.PlasticPhiFieldApplication = PlasticPhiFieldApplication;
22080+
PlasticPhiFieldApplication["__class"] = "com.vzome.core.kinds.PlasticPhiFieldApplication";
22081+
PlasticPhiFieldApplication["__interfaces"] = ["com.vzome.core.math.symmetry.Symmetries4D", "com.vzome.core.editor.FieldApplication"];
22082+
})(kinds = core.kinds || (core.kinds = {}));
22083+
})(core = vzome.core || (vzome.core = {}));
22084+
})(vzome = com.vzome || (com.vzome = {}));
22085+
})(com || (com = {}));
2197222086
(function (com) {
2197322087
var vzome;
2197422088
(function (vzome) {

online/src/worker/legacy/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export const loadAndInjectResource = async ( path, url ) =>
369369
addLegacyField( vzomePkg.core.algebra.SnubDodecField, vzomePkg.core.kinds.SnubDodecFieldApplication )
370370
addLegacyField( vzomePkg.core.algebra.SuperGoldenField, vzomePkg.core.kinds.DefaultFieldApplication )
371371
addLegacyField( vzomePkg.core.algebra.PlasticNumberField, vzomePkg.core.kinds.DefaultFieldApplication )
372-
addLegacyField( vzomePkg.core.algebra.PlasticPhiField, vzomePkg.core.kinds.DefaultFieldApplication )
372+
addLegacyField( vzomePkg.core.algebra.PlasticPhiField, vzomePkg.core.kinds.PlasticPhiFieldApplication )
373373
addLegacyField( vzomePkg.core.algebra.EdPeggField, vzomePkg.core.kinds.DefaultFieldApplication )
374374
});
375375
const getFieldApp = ( name='golden' ) =>

online/src/worker/legacy/ts/com/vzome/core/editor/SymmetrySystem.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ namespace com.vzome.core.editor {
5252
} else throw new Error('invalid overload');
5353
}
5454
/* Default method injected from com.vzome.core.editor.api.OrbitSource */
55-
getOrientations$(): number[][] {
56-
return this.getOrientations(false);
55+
getZone(orbit: string, orientation: number): com.vzome.core.math.symmetry.Axis {
56+
return this.getSymmetry().getDirection(orbit).getAxis(com.vzome.core.math.symmetry.Symmetry.PLUS, orientation);
5757
}
5858
/* Default method injected from com.vzome.core.editor.api.OrbitSource */
5959
getEmbedding(): number[] {
@@ -75,8 +75,8 @@ namespace com.vzome.core.editor {
7575
return embedding;
7676
}
7777
/* Default method injected from com.vzome.core.editor.api.OrbitSource */
78-
getZone(orbit: string, orientation: number): com.vzome.core.math.symmetry.Axis {
79-
return this.getSymmetry().getDirection(orbit).getAxis(com.vzome.core.math.symmetry.Symmetry.PLUS, orientation);
78+
getOrientations$(): number[][] {
79+
return this.getOrientations(false);
8080
}
8181
static LOGGER: java.util.logging.Logger; public static LOGGER_$LI$(): java.util.logging.Logger { if (SymmetrySystem.LOGGER == null) { SymmetrySystem.LOGGER = java.util.logging.Logger.getLogger("com.vzome.core.editor"); } return SymmetrySystem.LOGGER; }
8282

online/src/worker/legacy/ts/com/vzome/core/edits/ReplaceWithShape.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ namespace com.vzome.core.edits {
195195
} else throw new Error('invalid overload');
196196
}
197197
/* Default method injected from com.vzome.core.editor.api.OrbitSource */
198-
getOrientations$(): number[][] {
199-
return this.getOrientations(false);
198+
getZone(orbit: string, orientation: number): com.vzome.core.math.symmetry.Axis {
199+
return this.getSymmetry().getDirection(orbit).getAxis(com.vzome.core.math.symmetry.Symmetry.PLUS, orientation);
200200
}
201201
/* Default method injected from com.vzome.core.editor.api.OrbitSource */
202202
getEmbedding(): number[] {
@@ -218,8 +218,8 @@ namespace com.vzome.core.edits {
218218
return embedding;
219219
}
220220
/* Default method injected from com.vzome.core.editor.api.OrbitSource */
221-
getZone(orbit: string, orientation: number): com.vzome.core.math.symmetry.Axis {
222-
return this.getSymmetry().getDirection(orbit).getAxis(com.vzome.core.math.symmetry.Symmetry.PLUS, orientation);
221+
getOrientations$(): number[][] {
222+
return this.getOrientations(false);
223223
}
224224
/**
225225
*
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/* Generated from Java with JSweet 3.2.0-SNAPSHOT - http://www.jsweet.org */
2+
namespace com.vzome.core.kinds {
3+
export class PlasticPhiFieldApplication extends com.vzome.core.kinds.DefaultFieldApplication {
4+
/*private*/ icosahedralPerspective: com.vzome.core.kinds.IcosahedralSymmetryPerspective;
5+
6+
symmetryPerspectives: java.util.List<com.vzome.core.editor.SymmetryPerspective>;
7+
8+
/*private*/ H4: com.vzome.core.math.symmetry.QuaternionicSymmetry;
9+
10+
public constructor(field: com.vzome.core.algebra.PlasticPhiField) {
11+
super(field);
12+
if (this.icosahedralPerspective === undefined) { this.icosahedralPerspective = null; }
13+
this.symmetryPerspectives = <any>(new java.util.ArrayList<any>());
14+
if (this.H4 === undefined) { this.H4 = null; }
15+
this.h4Builder = null;
16+
this.icosahedralPerspective = new com.vzome.core.kinds.IcosahedralSymmetryPerspective(this.getField());
17+
this.symmetryPerspectives.add(this.icosahedralPerspective);
18+
this.symmetryPerspectives.add(super.getDefaultSymmetryPerspective());
19+
this.H4 = new com.vzome.core.math.symmetry.QuaternionicSymmetry("H_4", "com/vzome/core/math/symmetry/H4roots.vef", this.getField());
20+
}
21+
22+
/**
23+
*
24+
* @return {com.vzome.core.algebra.PlasticPhiField}
25+
*/
26+
public getField(): com.vzome.core.algebra.PlasticPhiField {
27+
return <com.vzome.core.algebra.PlasticPhiField><any>super.getField();
28+
}
29+
30+
/**
31+
*
32+
* @return {*}
33+
*/
34+
public getSymmetryPerspectives(): java.util.Collection<com.vzome.core.editor.SymmetryPerspective> {
35+
return this.symmetryPerspectives;
36+
}
37+
38+
/**
39+
*
40+
* @return {*}
41+
*/
42+
public getDefaultSymmetryPerspective(): com.vzome.core.editor.SymmetryPerspective {
43+
return this.icosahedralPerspective;
44+
}
45+
46+
/**
47+
*
48+
* @param {string} symmName
49+
* @return {*}
50+
*/
51+
public getSymmetryPerspective(symmName: string): com.vzome.core.editor.SymmetryPerspective {
52+
for(let index=this.symmetryPerspectives.iterator();index.hasNext();) {
53+
let sp = index.next();
54+
{
55+
if (sp.getName() === symmName){
56+
return sp;
57+
}
58+
}
59+
}
60+
return super.getSymmetryPerspective(symmName);
61+
}
62+
63+
/**
64+
*
65+
* @param {*} toolFactories
66+
* @param {com.vzome.core.editor.ToolsModel} tools
67+
*/
68+
public registerToolFactories(toolFactories: java.util.Map<string, com.vzome.api.Tool.Factory>, tools: com.vzome.core.editor.ToolsModel) {
69+
super.registerToolFactories(toolFactories, tools);
70+
const symm: com.vzome.core.math.symmetry.IcosahedralSymmetry = this.icosahedralPerspective.getSymmetry();
71+
toolFactories.put("AxialStretchTool", new com.vzome.core.tools.AxialStretchTool.Factory(tools, symm, false, false, false));
72+
toolFactories.put("SymmetryTool", new com.vzome.core.tools.IcosahedralToolFactory(tools, symm));
73+
}
74+
75+
/**
76+
*
77+
* @param {string} name
78+
* @return {com.vzome.core.math.symmetry.QuaternionicSymmetry}
79+
*/
80+
public getQuaternionSymmetry(name: string): com.vzome.core.math.symmetry.QuaternionicSymmetry {
81+
switch((name)) {
82+
case "H_4":
83+
return this.H4;
84+
default:
85+
return null;
86+
}
87+
}
88+
89+
/*private*/ h4Builder: com.vzome.core.commands.CommandUniformH4Polytope;
90+
91+
/**
92+
*
93+
* @param {string} groupName
94+
* @param {number} index
95+
* @param {number} edgesToRender
96+
* @param {com.vzome.core.algebra.AlgebraicNumber[]} edgeScales
97+
* @param {*} listener
98+
*/
99+
public constructPolytope(groupName: string, index: number, edgesToRender: number, edgeScales: com.vzome.core.algebra.AlgebraicNumber[], listener: com.vzome.core.math.symmetry.WythoffConstruction.Listener) {
100+
switch((groupName)) {
101+
case "H4":
102+
if (this.h4Builder == null){
103+
const qsymm: com.vzome.core.math.symmetry.QuaternionicSymmetry = new com.vzome.core.math.symmetry.QuaternionicSymmetry("H_4", "com/vzome/core/math/symmetry/H4roots.vef", this.getField());
104+
this.h4Builder = new com.vzome.core.commands.CommandUniformH4Polytope(this.getField(), qsymm, 0);
105+
}
106+
this.h4Builder.generate(index, edgesToRender, edgeScales, listener);
107+
break;
108+
default:
109+
super.constructPolytope(groupName, index, edgesToRender, edgeScales, listener);
110+
break;
111+
}
112+
}
113+
}
114+
PlasticPhiFieldApplication["__class"] = "com.vzome.core.kinds.PlasticPhiFieldApplication";
115+
PlasticPhiFieldApplication["__interfaces"] = ["com.vzome.core.math.symmetry.Symmetries4D","com.vzome.core.editor.FieldApplication"];
116+
117+
118+
}
119+

online/src/worker/legacy/ts/com/vzome/core/render/RenderedModel.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ namespace com.vzome.core.render {
459459
} else throw new Error('invalid overload');
460460
}
461461
/* Default method injected from com.vzome.core.editor.api.OrbitSource */
462-
getOrientations$(): number[][] {
463-
return this.getOrientations(false);
462+
getZone(orbit: string, orientation: number): com.vzome.core.math.symmetry.Axis {
463+
return this.getSymmetry().getDirection(orbit).getAxis(com.vzome.core.math.symmetry.Symmetry.PLUS, orientation);
464464
}
465465
/* Default method injected from com.vzome.core.editor.api.OrbitSource */
466466
getEmbedding(): number[] {
@@ -482,8 +482,8 @@ namespace com.vzome.core.render {
482482
return embedding;
483483
}
484484
/* Default method injected from com.vzome.core.editor.api.OrbitSource */
485-
getZone(orbit: string, orientation: number): com.vzome.core.math.symmetry.Axis {
486-
return this.getSymmetry().getDirection(orbit).getAxis(com.vzome.core.math.symmetry.Symmetry.PLUS, orientation);
485+
getOrientations$(): number[][] {
486+
return this.getOrientations(false);
487487
}
488488
symmetry: com.vzome.core.math.symmetry.Symmetry;
489489

0 commit comments

Comments
 (0)