Skip to content

Commit 75208b8

Browse files
committed
error in MeasureD.projectPointTo
automatically sets v.applet.app to (JavaScript-only) return from main()
1 parent f7f6309 commit 75208b8

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20230606023002
1+
20230726212918
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20230606023002
1+
20230726212918

sources/net.sf.j2s.java.core/src/javajs/util/MeasureD.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ public static T3d[] computeHelicalAxis(P3d a, P3d b, Qd dq) {
113113
// a'+---------a
114114
// r
115115

116-
V3d vab = new V3d();
117-
vab.sub2(b, a);
116+
V3d vab = V3d.newVsub(b, a);
118117
/*
119118
* testing here to see if directing the normal makes any difference -- oddly
120119
* enough, it does not. When n = -n and theta = -theta vab.n is reversed,
@@ -125,7 +124,7 @@ public static T3d[] computeHelicalAxis(P3d a, P3d b, Qd dq) {
125124
double theta = dq.getTheta();
126125
V3d n = dq.getNormal();
127126
double v_dot_n = vab.dot(n);
128-
if (Math.abs(v_dot_n) < 0.0001f)
127+
if (Math.abs(v_dot_n) < 0.0001)
129128
v_dot_n = 0;
130129
V3d va_prime_d = new V3d();
131130
va_prime_d.cross(vab, n);
@@ -137,7 +136,7 @@ public static T3d[] computeHelicalAxis(P3d a, P3d b, Qd dq) {
137136
v_dot_n = 2E-45; // allow for perpendicular axis to vab
138137
vcb.scale(v_dot_n);
139138
vda.sub2(vcb, vab);
140-
vda.scale(0.5f);
139+
vda.scale(0.5d);
141140
va_prime_d.scale(theta == 0 ? 0 : (vda.length() / Math.tan(theta
142141
/ 2 / 180 * Math.PI)));
143142
V3d r = V3d.newV(va_prime_d);
@@ -152,12 +151,12 @@ public static T3d[] computeHelicalAxis(P3d a, P3d b, Qd dq) {
152151
P3d pt_b_prime = P3d.newP(pt_a_prime);
153152
pt_b_prime.add(n);
154153
theta = computeTorsion(a, pt_a_prime, pt_b_prime, b, true);
155-
if (Double.isNaN(theta) || r.length() < 0.0001f)
154+
if (Double.isNaN(theta) || r.length() < 0.0001)
156155
theta = dq.getThetaDirectedV(n); // allow for r = 0
157156
// anything else is an array
158157
double residuesPerTurn = Math.abs(theta == 0 ? 0 : 360f / theta);
159158
double pitch = Math.abs(v_dot_n == 2E-45 ? 0 : n.length()
160-
* (theta == 0 ? 1 : 360f / theta));
159+
* (theta == 0 ? 1 : 360.0 / theta));
161160
return new T3d[] { pt_a_prime, n, r, P3d.new3(theta, pitch, residuesPerTurn), pt_b_prime };
162161
}
163162

@@ -1005,7 +1004,7 @@ public static Lst<P3d> getLatticePoints(Lst<P3d> cpts, int h, int k, int l) {
10051004
}
10061005
}
10071006
for (int i = n; --i >= 0;)
1008-
cpts.removeItemAt(i);
1007+
cpts.removeItemAt(0);
10091008
return cpts;
10101009
}
10111010

sources/net.sf.j2s.java.core/src/swingjs/JSDummyApplet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public Class<?> runMain(JSAppletViewer v, String[] args) {
2626
* @j2sNative
2727
*
2828
* setTimeout(function(){
29-
* theClass.$clazz$.main$SA.call(null, args || []);
29+
* v.applet.app = theClass.$clazz$.main$SA.call(null, args || []) || null;
3030
*/
3131
JSUtil.readyCallback(v.appletName, v.fullName, v.applet, v);
3232
/**

0 commit comments

Comments
 (0)