| |
---|
| | newPoints.add(new PointComp( |
---|
| | (0.1+gradX*point.getRotatedPoint().x-point.getRotatedPoint().z)/gradX, |
---|
| | (0.1+gradY*point.getRotatedPoint().y-point.getRotatedPoint().z)/gradY, |
---|
| | 0.1)); |
---|
| | if(Double.isFinite(gradX)){ |
---|
| | if(!Double.isFinite(gradX)){ |
---|
| | newPoints.get(newPoints.size() - 1).point.x = point.getRotatedPoint().x;} |
---|
| | if(Double.isFinite(gradY)){ |
---|
| | if(!Double.isFinite(gradY)){ |
---|
| | newPoints.get(newPoints.size() - 1).point.y = point.getRotatedPoint().y;} |
---|
| | } |
---|
| | // finally - if the current point is valid, then add it to the list |
---|
| | if(thisValid){ |
---|
| |
---|
| | point.getRotatedPoint().x, |
---|
| | point.getRotatedPoint().y, |
---|
| | point.getRotatedPoint().z)); |
---|
| | } |
---|
| | lastPoint = point; |
---|
| | lastValid = thisValid; |
---|
| | } |
---|
| | // finished fixing points, now we need to create a new face consisting of those points. |
---|
| | fixedFace.points = newPoints.toArray(new PointComp[0]); |
---|
| | fixedFace.separateTris(); |
---|
| | // invalidate all the points so they are actually calculated |
---|
| | for (PointComp point: |
---|
| | newPoints) { |
---|
| | point.invalidate(); |
---|
| | // there must be at least 3 points in the face for it to be drawn successfully |
---|
| | if(newPoints.size() >= 3) { |
---|
| | // finished fixing points, now we need to create a new face consisting of those points. |
---|
| | fixedFace.points = newPoints.toArray(new PointComp[0]); |
---|
| | fixedFace.separateTris(); |
---|
| | // invalidate all the points so they are actually calculated |
---|
| | for (PointComp point : |
---|
| | newPoints) { |
---|
| | point.invalidate(); |
---|
| | } |
---|
| | fixedFace.draw(img, zBuf, debugImg, fixedFace.perspectiveMappingMatrix, FPDis, scrX, scrY); |
---|
| | } |
---|
| | fixedFace.draw(img, zBuf, debugImg, fixedFace.perspectiveMappingMatrix, FPDis, scrX, scrY); |
---|
| | } |
---|
| | return numberOfPixels; |
---|
| | } |
---|
| | public void separateTris(){ |
---|
| |
---|
| | |