/** * @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));
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; }