public static int[][] buildNormalsIndexs(MeshFactory meshFactory, Point3d[][] mesh, Point3d center3d, int pointCount, int crossCount) { int[][] softNormalsIndexs = new int[pointCount][]; for (int i = 0; i < pointCount; i++) { softNormalsIndexs[i] = new int[crossCount]; for (int j = 0; j < crossCount; j++) { Point3d p = mesh[i][j]; Vector3d n = Vector3dUtil.fromTo(center3d, p); n.normalize(); int in = meshFactory.addNormal(n); softNormalsIndexs[i][j] = in; } } return softNormalsIndexs; }
@Override public EditorChangeEvent move(Ray3d moveRay, boolean finish) { Point3d editorOrigin = getEditorOrigin(); Vector3d normal = new Vector3d(getVector()); normal.normalize(); Ray3d arrowRay = new Ray3d(editorOrigin, normal); Point3d closestPointOnBaseRay = Ray3dUtil.closestPointOnBaseRay(moveRay, arrowRay); Vector3d moveVector = Vector3dUtil.fromTo(editorOrigin, closestPointOnBaseRay); double lenghtOnEditor = normal.dot(moveVector); double length = lenghtOnEditor - spotFloatingOffset(moveRay.getPoint()); setLength(length); ArrowEditorChangeEvent event = new ArrowEditorChangeEvent(finish, this, length, closestPointOnBaseRay); raiseEditorChange(event); return event; }
Vector3d segmentVector = Vector3dUtil.fromTo(begin, end); segmentVector.normalize(); segmentVector.scale(segmentLength);
Vector3d arrowVector = Vector3dUtil.fromTo(bottomArrowhead, topArrowhead); arrowVector.normalize(); arrowVector.scale(arrowHeight);