/** * Build roof hook space for rectangle edge. * * @param pEdge * rectangle edge number XXX * @param pRectangleContur * rectangle XXX * @param pPolygonPlane * polygon and plane defining height connected with rectangle * edge * @return roof hook space */ public static PolygonRoofHooksSpace buildRecHookSpace(Point2d p1, Vector2d v1, PolygonPlane pPolygonPlane) { if (pPolygonPlane == null) { return null; } Plane3d plane = new Plane3d(pPolygonPlane.getPlane().getPoint(), pPolygonPlane.getPlane().getNormal()); return new PolygonRoofHooksSpace(p1, v1, pPolygonPlane.getPolygon(), plane); }
plane2.getPoint(), roofTexture, textureOffsetU, textureOffsetV);
Point3d planePoint= TransformationMatrix3d.transform(pPlane.getPoint(), tr3d); Vector3d planeNormal = TransformationMatrix3d.transform(pPlane.getNormal(), tr3d);
/** * @param pMeshRoof * @param pPlane * @param pTextureVector * @param pTextureData * @param textureOffsetU * @param textureOffsetV * @param normalIndex * @param face * @param point2d */ private static void addPointToTriangleFace(MeshFactory pMeshRoof, Plane3d pPlane, Vector3d pTextureVector, TextureData pTextureData, double textureOffsetU, double textureOffsetV, int normalIndex, FaceFactory face, Point2d point2d) { double h = pPlane.calcYOfPlane(point2d.x, -point2d.y); Point3d point3d = new Point3d(point2d.x, h, -point2d.y); int vi = pMeshRoof.addVertex(point3d); // Point3d point3d = pMeshRoof.vertices.get(vi); face.addVertIndex(vi); face.addNormalIndex(normalIndex); TextCoord calcUV = TextCordFactory.calcFlatSurfaceUV(point3d, pPlane.getNormal(), pTextureVector, pPlane.getPoint(), pTextureData, textureOffsetU, textureOffsetV); int tci = pMeshRoof.addTextCoord(calcUV); face.addCoordIndex(tci); }
public RectangleRoofHooksSpace(Point2d p1, Vector2d v1, double b, Plane3d pPlane) { super(); // this.p1 = p1; // this.v1 = v1; this.b = b; double angle = Math.atan2(v1.y, v1.x); // Math.toDegrees(angle); SimpleMatrix tr2d = TransformationMatrix2d.rotZA(-angle).mult(TransformationMatrix2d.tranA(-p1.x, -p1.y)); SimpleMatrix tr3d = TransformationMatrix3d.rotYA(-angle).mult(TransformationMatrix3d.tranA(-p1.x, 0, p1.y)); this.p1 = TransformationMatrix2d.transform(p1, tr2d); this.v1 = TransformationMatrix2d.transform(v1, tr2d); Point3d planePoint= TransformationMatrix3d.transform(pPlane.getPoint(), tr3d); Vector3d planeNormal = TransformationMatrix3d.transform(pPlane.getNormal(), tr3d); this.plane = new Plane3d(planePoint, planeNormal); SimpleMatrix trBack = TransformationMatrix3d.rotYA(angle).mult(TransformationMatrix3d.tranA(-p1.x, 0, p1.y)); this.transformationMatrix = trBack; }