Merge pull request #1859 from SiboVG/issue-1679
[#1679] Render fin set even if zero length
This commit is contained in:
commit
bc547694ba
@ -644,7 +644,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
||||
|
||||
// calculate marginal area
|
||||
final double delta_x = (cur.x - prev.x);
|
||||
final double y_avg = (cur.y + prev.y)*0.5;
|
||||
final double y_avg = (cur.y + prev.y)*0.5; // TODO: MEDIUM: what if one of the points is below the x-axis? (can produce negative area)
|
||||
double area_increment = delta_x*y_avg;
|
||||
if( MathUtil.equals( 0, area_increment)){
|
||||
prev = cur;
|
||||
@ -663,6 +663,11 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
||||
prev=cur;
|
||||
}
|
||||
|
||||
// Negative weight => make positive. TODO: This is NOT a correct solution, but at least it won't throw an exception...
|
||||
if (centroidSum.weight < 0) {
|
||||
centroidSum = new Coordinate(centroidSum.x, -centroidSum.y, centroidSum.z, Math.abs(centroidSum.weight));
|
||||
}
|
||||
|
||||
return centroidSum;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class FinRenderer {
|
||||
GLU.gluTessCallback(tess, GLU.GLU_TESS_COMBINE, cb);
|
||||
|
||||
// fin side: +z
|
||||
if (finSet.getSpan() > 0 && finSet.getLength() > 0 && which == Surface.INSIDE) { // Right side
|
||||
if (finSet.getSpan() > 0 && which == Surface.INSIDE) { // Right side
|
||||
GLU.gluTessBeginPolygon(tess, null);
|
||||
GLU.gluTessBeginContour(tess);
|
||||
gl.glNormal3f(0, 0, 1);
|
||||
@ -110,7 +110,7 @@ public class FinRenderer {
|
||||
}
|
||||
|
||||
// fin side: -z
|
||||
if (finSet.getSpan() > 0 && finSet.getLength() > 0 && which == Surface.OUTSIDE) { // Left side
|
||||
if (finSet.getSpan() > 0 && which == Surface.OUTSIDE) { // Left side
|
||||
GLU.gluTessBeginPolygon(tess, null);
|
||||
GLU.gluTessBeginContour(tess);
|
||||
gl.glNormal3f(0, 0, -1);
|
||||
@ -142,7 +142,7 @@ public class FinRenderer {
|
||||
GLU.gluDeleteTess(tess);
|
||||
|
||||
// Fin strip around the edge
|
||||
if (finSet.getSpan() > 0 && finSet.getLength() > 0 && which == Surface.EDGES) {
|
||||
if (finSet.getSpan() > 0 && which == Surface.EDGES) {
|
||||
if (!(finSet instanceof EllipticalFinSet))
|
||||
gl.glShadeModel(GLLightingFunc.GL_FLAT);
|
||||
gl.glBegin(GL.GL_TRIANGLE_STRIP);
|
||||
|
Loading…
x
Reference in New Issue
Block a user