private Point2d transformToLocal(Point2d point) { return TransformationMatrix2d.transform(point, transformationToLocal); } }
private SegmentHeight transformToGlobal(SegmentHeight segmentHeight) { Point2d begin = segmentHeight.getBegin(); Point2d end = segmentHeight.getEnd(); double beginHeight = segmentHeight.getBeginHeight(); double endHeight = segmentHeight.getEndHeight(); /* Do transformation to global frame. */ return new SegmentHeight( // TransformationMatrix2d.transform(begin, transformationToGlobal),// beginHeight + transformToGlobalHeightOffset, // TransformationMatrix2d.transform(end, transformationToGlobal),// endHeight + transformToGlobalHeightOffset); }
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); List<Point2d> transformPolygon = new ArrayList<Point2d>(); for (Point2d point : polygon) { transformPolygon.add(TransformationMatrix2d.transform(point, tr2d));
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; }