/** * @param x * @param y * @param alpha * @param sizeA * @param sizeB * @return */ public static SimpleMatrix trandformToLocalMatrix2d(double x, double y, double alpha) { SimpleMatrix transfLocal = TransformationMatrix2d.tranA(-x, -y); SimpleMatrix rotLocal = TransformationMatrix2d.rotZA(-alpha); // XXX test me return rotLocal.mult(transfLocal); }
/** * Prepare transformation matrix from local rectangle roof coordinates to * global building coordinates. * * @param startPoint * rectangle roof starting point * * @param alpha * roof angle * @return */ public static SimpleMatrix prepareTransformMatrixToGlobal2d(Point2d startPoint, double alpha) { SimpleMatrix transf = TransformationMatrix2d.tranA(startPoint.x, startPoint.y); SimpleMatrix rot = TransformationMatrix2d.rotZA(alpha); // XXX test me return transf.mult(rot); }
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));
@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 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) { 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; }
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 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; }