/** * Prepare transformation matrix from local rectangle roof coordinates to * global building coordinates. * * @param startPoint * rectangle roof starting point * @param height * roof minimal height * @param alpha * roof angle * @return */ public static SimpleMatrix prepareTransformToGlobalMatrix3d(Point2d startPoint, double height, double alpha) { SimpleMatrix transf = TransformationMatrix3d.tranA(startPoint.x, height, -startPoint.y); SimpleMatrix rot = TransformationMatrix3d.rotYA(alpha); // XXX test me return transf.mult(rot); }
private static Point3d[][] buildMesh(Point2d center, Point2d[] crossSection, int sectionCount) { int crossCount = crossSection.length; Point3d[][] mesh = new Point3d[sectionCount][]; for (int i = 0; i < sectionCount; i++) { double a = Math.toRadians(360) / sectionCount * i; SimpleMatrix tranA = TransformationMatrix3d.tranA(center.x, 0, -center.y); SimpleMatrix rotY = TransformationMatrix3d.rotYA(a); SimpleMatrix trans = tranA.mult(rotY); Point3d[] crossMesh = new Point3d[crossCount]; for (int j = 0; j < crossSection.length; j++) { // point Point2d cross = crossSection[j]; Point3d p = new Point3d(cross.x, cross.y, 0); crossMesh[j] = TransformationMatrix3d.transform(p, trans); } mesh[i] = crossMesh; } return mesh; }
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; }
@Override public RoofTypeOutput buildRoof(Point2d startPoint, PolygonWithHolesList2d buildingPolygon, DormerRoofModel roof, double height, RoofMaterials roofTextureData) { SimpleMatrix transformLocal = TransformationMatrix2d.tranA(-startPoint.x, -startPoint.y); PolygonWithHolesList2d buildingTransformed = PolygonWithHolesList2dUtil.transform(buildingPolygon, transformLocal); Measurement measurement = roof.getMeasurements().get(MeasurementKey.HEIGHT_1); Double h1 = null; Double angle = null; if (isUnit(measurement, MeasurementUnit.DEGREES)) { angle = measurement.getValue(); } else { h1 = getHeightMeters(roof.getMeasurements(), MeasurementKey.HEIGHT_1, 2.5d); } RoofTypeOutput rto = build(buildingTransformed, h1, angle, 0, 0, roofTextureData); SimpleMatrix transformGlobal = TransformationMatrix3d.tranA(startPoint.x, height - rto.getHeight(), -startPoint.y); rto.setTransformationMatrix(transformGlobal); return rto; }
@Override public RoofTypeOutput buildRoof(Point2d pStartPoint, PolygonWithHolesList2d buildingPolygon, DormerRoofModel pRoof, double height, RoofMaterials roofTextureData) { SimpleMatrix transformLocal = TransformationMatrix2d.tranA(-pStartPoint.x, -pStartPoint.y); List<Point2d> polygon = buildingPolygon.getOuter().getPoints(); polygon = TransformationMatrix2d.transformList(polygon, transformLocal); Double h1 = null; Double angle = null; Measurement measurement = pRoof.getMeasurements().get(MeasurementKey.HEIGHT_1); if (isUnit(measurement, MeasurementUnit.DEGREES)) { angle = measurement.getValue(); } else { h1 = getHeightMeters(pRoof.getMeasurements(), MeasurementKey.HEIGHT_1, DEFAULT_ROOF_HEIGHT); } RoofTypeOutput rto = build(polygon, h1, angle, roofTextureData); SimpleMatrix transformGlobal = TransformationMatrix3d.tranA(pStartPoint.x, height - rto.getHeight(), -pStartPoint.y); rto.setTransformationMatrix(transformGlobal); return rto; }
@Override public RoofTypeOutput buildRoof(Point2d startPoint, PolygonWithHolesList2d buildingPolygon, DormerRoofModel roof, double height, RoofMaterials roofTextureData) { SimpleMatrix transformLocal = TransformationMatrix2d.tranA(-startPoint.x, -startPoint.y); List<Point2d> polygon = buildingPolygon.getOuter().getPoints(); polygon = TransformationMatrix2d.transformList(polygon, transformLocal); Double h1 = null; Double angle = null; Measurement measurement = roof.getMeasurements().get(MeasurementKey.HEIGHT_1); if (isUnit(measurement, MeasurementUnit.DEGREES)) { angle = measurement.getValue(); } else { h1 = getHeightMeters(roof.getMeasurements(), MeasurementKey.HEIGHT_1, DEFAULT_ROOF_HEIGHT); } RoofTypeOutput rto = build(polygon, h1, angle, roofTextureData); SimpleMatrix transformGlobal = TransformationMatrix3d.tranA(startPoint.x, height - rto.getHeight(), -startPoint.y); rto.setTransformationMatrix(transformGlobal); return rto; }
@Override public RoofTypeOutput buildRoof(Point2d pStartPoint, PolygonWithHolesList2d buildingPolygon, DormerRoofModel pRoof, double height, RoofMaterials roofTextureData) { List<Point2d> pPolygon = buildingPolygon.getOuter().getPoints(); SimpleMatrix transformLocal = TransformationMatrix2d.tranA(-pStartPoint.x, -pStartPoint.y); pPolygon = TransformationMatrix2d.transformList(pPolygon, transformLocal); // rectangleContur = // TransformationMatrix2d.transformArray(rectangleContur, // transformLocal); PolygonList2d borderPolygon = new PolygonList2d(pPolygon); Circle circle = CircleInsidePolygon.iterativeNonConvex(borderPolygon, 0.01); int isection = getIsection(pRoof.getRoofTypeParameter()); boolean soft = isSoft(pRoof.getRoofTypeParameter()); Bend[] bends = getBends(pRoof.getMeasurements(), circle); RoofTypeOutput rto = build(pPolygon, circle.getPoint(), bends, isection, soft, roofTextureData); SimpleMatrix transformGlobal = TransformationMatrix3d.tranA(pStartPoint.x, height - rto.getHeight(), -pStartPoint.y); rto.setTransformationMatrix(transformGlobal); return rto; }
SimpleMatrix tranA = TransformationMatrix3d.tranA(extPoint.x, extPoint.y, extPoint.z);
SimpleMatrix tranA = TransformationMatrix3d.tranA(extPoint.x, extPoint.y, extPoint.z);