public static List<Point2d> removeClosePoints(List<Point2d> points) { // XXX change to point2d ! return removeClosePoints(points, EPSILON); }
/** * Calculates height of point where it intersect with the plane. * * @param point * the 2d point * @param plane * the surface plane * @return the height of point where it intersect with the plane */ private double calcHeight(Point2d point, Plane3d plane) { double x = point.x; double z = -point.y; return plane.calcYOfPlane(x, z); }
/** * Calculate height of point in wall. * * @param point * the point * @param mLine * the middle line * @param planeTop * the top plane * @param planeBottom * the bottom plane * @return */ private static double calcHeight(Point2d point, LinePoints2d mLine, Plane3d planeTop, Plane3d planeBottom) { double x = point.x; double z = -point.y; if (mLine.inFront(point)) { return planeTop.calcYOfPlane(x, z); } else { return planeBottom.calcYOfPlane(x, z); } } }
Vector3d pTextureVector, TextureData pTextureData, double textureOffsetU, double textureOffsetV) { int normalIndex = pMeshRoof.addNormal(pPlane.getNormal()); normalIndex, face, triangle.getP1()); addPointToTriangleFace(pMeshRoof, pPlane, pTextureVector, pTextureData, textureOffsetU, textureOffsetV, normalIndex, face, triangle.getP2()); addPointToTriangleFace(pMeshRoof, pPlane, pTextureVector, pTextureData, textureOffsetU, textureOffsetV, normalIndex, face, triangle.getP3());
private List<Point2d> calsHookPoints(List<Point2d> points, Integer numOfTrees) { double area = Math.abs(Triangulate.area(points)); if (numOfTrees == null) { // 1 tree on 100 square meters numOfTrees = (int) Math.round(area / 100d); } if (numOfTrees > 1000) { // XXX numOfTrees = 1000; } PolygonList2d polygon = new PolygonList2d(points); return monteCarloHookGenerator(polygon, numOfTrees); }
/** * 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); }
@Override public Object evalZeroParam(Context context) { Vector2d bisector = Context.getRequiredContextVariable("bisector", context, Vector2d.class); return Math.toDegrees(AngleUtil.angle(Vector2dUtil.orthogonalLeft(bisector))); }
public static void main(String[] args) { Triangulate t = new Triangulate(); List<Point2d> pContour = new ArrayList<Point2d>(); pContour.add(new Point2d(1.895497121847469, -43.471537857796115)); pContour.add(new Point2d(-0.9242217038848146, -42.12385244107362)); pContour.add(new Point2d(-3.743943196278786, -40.77616574981941)); pContour.add(new Point2d(2.2851311803030017, -28.168042068609704)); List<Integer> processIndex = t.processIndex(pContour); }
public static Plane3d[] createPlanes(List<CrossSectionElement> crossSection) { Plane3d[] seg = new Plane3d[crossSection.size() - 1]; for (int i = 1; i < crossSection.size(); i++) { CrossSectionElement first = crossSection.get(i - 1); CrossSectionElement second = crossSection.get(i); Point3d p = new Point3d(0, first.p.y, -first.p.x); Vector3d v = new Vector3d(0, second.p.x - first.p.x, second.p.y - first.p.y); v.normalize(); Plane3d plane3d = new Plane3d(p, v); seg[i - 1] = plane3d; } return seg; }
public static List<Point2d> process(List<Point2d> contour) { List<Point2d> result = new ArrayList<Point2d>(); process(contour, result); return result; }
private Point2d[] calcRectangle(List<Point2d> polygon, Vector2d direction) { RectanglePointVector2d contur = RectangleUtil.findRectangleContur(polygon, direction); return rectToList(contur); }
static boolean snip(List<Point2d> contour, int u, int v, int w, int n,/* ??? */ int[] V) { int p; double Ax, Ay, Bx, By, Cx, Cy, Px, Py; Ax = contour.get(V[u]).x; Ay = contour.get(V[u]).y; Bx = contour.get(V[v]).x; By = contour.get(V[v]).y; Cx = contour.get(V[w]).x; Cy = contour.get(V[w]).y; if (EPSILON > (Bx - Ax) * (Cy - Ay) - (By - Ay) * (Cx - Ax)) { return false; } for (p = 0; p < n; p++) { if (p == u || p == v || p == w) { continue; } Px = contour.get(V[p]).x; Py = contour.get(V[p]).y; if (insideTriangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py)) { return false; } } return true; }
@Override public Double eval(Context context) { Double argument = getOptionalArgument(0, Double.class); if (argument == null) { argument = 0d; } Vector2d bisector = getRequiredContextVariable("bisector", context, Vector2d.class); return Math.toDegrees(AngleUtil.angle(Vector2dUtil.orthogonalLeft(bisector))) + argument; }
/** * Calculates height of point in wall. * * @param point * @param rLine * @param lLine * @param planeLeft * @param planeRight * @param planeButtom * @param planeTop * @return */ private static double calcHeight(Point2d point, LinePoints2d lLine, Plane3d planeButtom, Plane3d planeTop) { double x = point.x; double z = -point.y; if (lLine.inFront(point)) { return planeButtom.calcYOfPlane(x, z); } else { return planeTop.calcYOfPlane(x, z); } }
/** * Calculates height of point in wall. * * @param point * the point * @param planeTop * the top plane * @return the height of point */ private static double calcHeight(Point2d point, Plane3d planeTop) { double x = point.x; double z = -point.y; return planeTop.calcYOfPlane(x, z); } }
public List<Point2d> removeClosePoints1(List<Point2d> pPoints) { return removeClosePoints(pPoints, EPSILON); }
/** * Calculates height of wall point under roof. * * @param point * the point * @param rLine * the right split line * @param lLine * the left split line * @param planeLeft * the left plane * @param planeRight * the right plane * @param planeButtom * the bottom plane * @return height of point */ private static double calcHeight(Point2d point, LinePoints2d rLine, LinePoints2d lLine, Plane3d planeLeft, Plane3d planeRight, Plane3d planeButtom) { double x = point.x; double z = -point.y; if (rLine.inFront(point)) { return planeRight.calcYOfPlane(x, z); } else if (lLine.inFront(point)) { return planeLeft.calcYOfPlane(x, z); } else { return planeButtom.calcYOfPlane(x, z); } }
/** * Calculate height of point in border. * * @param point * @param mLine * @param planeTop * @param planeBottom * @return */ private double calcHeight(Point2d point, Plane3d plane) { double x = point.x; double z = -point.y; return plane.calcYOfPlane(x, z); }