Skip to content

Commit 244797c

Browse files
committed
Merge branch 'Alignment-and-cleanup-of-Axis' of https://github.com/rondlh/BowlerStudio.git into development
2 parents dd866ce + 6028a0d commit 244797c

File tree

1 file changed

+25
-39
lines changed
  • src/main/java/com/neuronrobotics/bowlerstudio/threed

1 file changed

+25
-39
lines changed

src/main/java/com/neuronrobotics/bowlerstudio/threed/Axis.java

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import eu.mihosoft.vrl.v3d.TextExtrude;
1010
import javafx.application.Platform;
1111
import javafx.scene.text.Font;
12+
1213
/*
1314
* Axis.java 1.0 98/11/25
1415
*
@@ -71,62 +72,47 @@ public class Axis extends Group {
7172
private CSG zText;
7273

7374
/**
74-
* Instantiates a new axis.
75+
* Instantiates a new XYZ-axis.
7576
*/
76-
public Axis(boolean isVis) {
77-
this(50,isVis);
77+
public Axis(boolean visible) {
78+
this(50, visible);
7879
}
7980

8081
// //////////////////////////////////////////
8182
//
82-
// create axis visual object
83+
// Create XYZ-axis visual object
8384
/**
8485
* Instantiates a new axis.
8586
*
86-
* @param i the i
87+
* @param length the axis length
8788
*/
8889
//
89-
public Axis(int i,boolean isVis) {
90-
double strokWidth = 0.5;
91-
92-
Affine xp = new Affine();
93-
xp.setTx(i / 2);
94-
95-
Font font = new Font(Font.getDefault().getName(), 5);
96-
90+
public Axis(int length, boolean visible) {
91+
double strokeWidth = 0.5;
9792

93+
Font font = new Font(Font.getDefault().getName(), 5);
9894

99-
xText = CSG.unionAll(TextExtrude.text((double)strokWidth,"x",font)).rotz(90).toXMin().movex(i).moveToCenterY().toZMax();
100-
//xText.getTransforms().add(xp);
101-
102-
Affine yp = new Affine();
103-
yp.setTy(i / 2);
104-
yText = CSG.unionAll(TextExtrude.text((double)strokWidth,"y",font)).rotz(90).mirrory().toYMin().movey(i).moveToCenterX().toZMax();
105-
//yText.getTransforms().add(yp);
106-
107-
// zp.setTz(i/2);
108-
Affine zTextAffine = new Affine();
109-
zTextAffine.setTz(i / 2);
110-
zTextAffine.setTx(i / 2);
111-
zTextAffine.appendRotation(-90, 0, 0, 0, 1, 0, 0);
112-
zTextAffine.appendRotation(180, 0, 0, 0, 0, 0, 1);
113-
zText = CSG.unionAll(TextExtrude.text((double)strokWidth,"z",font)).rotx(90).rotz(90).mirrory().movez(i).moveToCenterY();
114-
//zText.getTransforms().add(zTextAffine);
115-
// zText.smoothProperty().set(false);
116-
xAxis = new Cube(i, strokWidth, strokWidth).toCSG().toXMin().toZMax();
117-
yAxis = new Cube( strokWidth,i, strokWidth).toCSG().toYMin().toZMax();
118-
zAxis = new Cube( strokWidth, strokWidth,i).toCSG().toZMin();
95+
xText = CSG.unionAll(TextExtrude.text((double)strokeWidth, "x", font)).rotz(90).toXMin().movex(length).moveToCenterY().toZMax();
96+
xAxis = new Cube(length, strokeWidth, strokeWidth).toCSG().toXMin().toZMax().movex(strokeWidth / 2);
97+
xAxis.setColor(Color.RED);
11998
xText.setColor(Color.RED);
12099

100+
yText = CSG.unionAll(TextExtrude.text((double)strokeWidth, "y", font)).rotz(90).mirrory().toYMin().movey(length).moveToCenterX().toZMax();
101+
yAxis = new Cube( strokeWidth, length, strokeWidth).toCSG().toYMin().toZMax().movey(strokeWidth / 2);
121102
yText.setColor(Color.GREEN);
122-
123-
zText.setColor(Color.BLUE);
124-
xAxis.setColor(Color.RED);
125-
126103
yAxis.setColor(Color.GREEN);
127104

105+
Affine zTextAffine = new Affine();
106+
zTextAffine.setTx(length / 2);
107+
zTextAffine.setTz(length / 2);
108+
zTextAffine.appendRotation( 90, 0, 0, 0, 1, 0, 1);
109+
zText = CSG.unionAll(TextExtrude.text((double)strokeWidth, "z", font)).rotx(90).rotz(90).mirrory().movez(length).moveToCenterY();
110+
111+
zAxis = new Cube( strokeWidth, strokeWidth, length).toCSG().toZMin().movez(-strokeWidth);
112+
zText.setColor(Color.BLUE);
128113
zAxis.setColor(Color.BLUE);
129-
if(isVis)
114+
115+
if (visible)
130116
show();
131117
else
132118
hide();
@@ -146,7 +132,7 @@ private void showAll() {
146132
} catch (Exception e) {
147133
}
148134
}
149-
}catch(Exception ex) {
135+
} catch(Exception ex) {
150136
// no exception on exit
151137
}
152138
}

0 commit comments

Comments
 (0)