Fix transition normals

This commit is contained in:
SiboVG 2023-08-23 19:06:17 +02:00
parent 29b60d723e
commit 9f36a7eb4a

View File

@ -85,10 +85,10 @@ public class TransitionExporter extends RocketComponentExporter<Transition> {
// Draw bottom and top face // Draw bottom and top face
if (!hasForeShoulder) { if (!hasForeShoulder) {
closeFace(insideForeRingVertices, outsideForeRingVertices, true); closeFace(outsideForeRingVertices, insideForeRingVertices, true);
} }
if (!hasAftShoulder) { if (!hasAftShoulder) {
closeFace(insideAftRingVertices, outsideAftRingVertices, false); closeFace(outsideAftRingVertices, insideAftRingVertices, false);
} }
} }
@ -359,8 +359,12 @@ public class TransitionExporter extends RocketComponentExporter<Transition> {
//// We need special nx normal when the radius changes //// We need special nx normal when the radius changes
float nx; float nx;
if (Double.compare(r, rNext) != 0) { if (Double.compare(r, rNext) != 0) {
final double slopeAngle = Math.atan(Math.abs(xNext - x) / (rNext - r)); final double slopeAngle = Math.atan((xNext - x) / (rNext - r));
nx = (float) Math.cos(Math.PI - slopeAngle); if (rNext > r) {
nx = (float) -Math.cos(slopeAngle);
} else {
nx = (float) Math.cos(slopeAngle);
}
} else { } else {
nx = 0; nx = 0;
} }