private void buildRotaryShape(MeshFactory meshFactory, Circle circle, int numberOfCrossSplits, int pIsection, boolean soft) { int crossCount = numberOfCrossSplits + 1; // create cross section Point2d[] crossSection = new Point2d[crossCount]; for (int i = 0; i < crossCount; i++) { double a = Math.toRadians(90) / (crossCount - 1) * i; crossSection[i] = new Point2d(Math.cos(a) * circle.getRadius(), Math.sin(a) * circle.getRadius()); } buildRotaryShape(meshFactory, circle.getPoint(), pIsection, crossSection, soft); }
protected RoofTypeOutput build(List<Point2d> borderList, Double height, Double angle, RoofMaterials roofTextureData) { MeshFactory meshDome = createRoofMesh(roofTextureData); TextureData roofTexture = roofTextureData.getRoof().getTextureData(); PolygonList2d borderPolygon = new PolygonList2d(borderList); // build circle Circle circle = CircleInsidePolygon.iterativeNonConvex(borderPolygon, 0.01); int pIcross = 5; buildRotaryShape(meshDome, borderList, circle.getPoint(), height, pIcross, roofTexture); RoofTypeOutput rto = new RoofTypeOutput(); rto.setHeight(height); rto.setMesh(Arrays.asList(meshDome)); rto.setRoofHooksSpaces(null); rto.setRectangle(RoofTypeUtil.findRectangle(borderList, 0)); 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; }