@Override public Object evalZeroParam(Context context) { Vector2d bisector = Context.getRequiredContextVariable("bisector", context, Vector2d.class); return Math.toDegrees(AngleUtil.angle(Vector2dUtil.orthogonalLeft(bisector))); }
private Vector2d getBisector(Point2d p1, Point2d p2) { return Vector2dUtil.orthogonalRight(Vector2dUtil.fromTo(p1, p2)); }
private Vector2d getBisector(Point2d p1, Point2d p2, Point2d p3) { Vector2d v = Vector2dUtil.bisector(p1, p2, p3); v.negate(); return v; }
private static Vector2d[] calsSoftNormals(Point2d[] crossSection) { Vector2d[] ret = new Vector2d[crossSection.length]; Vector2d[] normals = new Vector2d[crossSection.length - 1]; for (int i = 0; i < crossSection.length - 1; i++) { Vector2d n = new Vector2d(crossSection[i + 1]); n.sub(crossSection[i]); n.normalize(); normals[i] = n; } for (int i = 1; i < crossSection.length - 1; i++) { Vector2d n1 = normals[i - 1]; Vector2d n2 = normals[i]; Vector2d n = Vector2dUtil.bisectorNormalized(n1, n2); n.normalize(); ret[i] = n; } ret[0] = Vector2dUtil.orthogonalLeft(normals[0]); ret[crossSection.length - 1] = Vector2dUtil.orthogonalLeft(normals[normals.length - 1]); for (Vector2d element : ret) { element.negate(); } return ret; }
private Vector3d calcFaceNormal(LineSegment2d edge, double heightFactor) { Vector2d edgeVector = Vector2dUtil.fromTo(edge.getBegin(), edge.getEnd()); edgeVector.normalize(); Vector2d edgeOrthogonal = Vector2dUtil.orthogonalLeft(edgeVector); Vector3d v1 = new Vector3d(edgeVector.x, 0, -edgeVector.y); Vector3d v2 = new Vector3d(edgeOrthogonal.x, heightFactor, -edgeOrthogonal.y); v1.cross(v1, v2); v1.normalize(); return v1; }
Vector2d n2 = new Vector2d(-v2.y, v2.x); Vector2d bisectorNormalized = Vector2dUtil.bisectorNormalized(v1, v2);
Vector2d direction = new Vector2d(direction3drEnd); direction.sub(direction3drBegin); return Vector2dUtil.orthogonalRight(direction);
@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; }
Vector2d direction = Vector2dUtil.orthogonalLeft(frontDirection); List<Point2d> points = polygon.getPoints(); maxV = Vector2dUtil.orthogonalLeft(maxV);