/** * Add a 3D line to this builder. * @param x0 x-coordinate of the line start. * @param y0 y-coordinate of the line start. * @param z0 z-coordinate of the line start. * @param xf x-coordinate of the line end. * @param yf y-coordinate of the line end. * @param zf z-coordinate of the line end. * @param lineWidth width of the line. * @param startColor color at the line start. Color accuracy depends on the color palette in use. * @param endColor color at the line end. Color accuracy depends on the color palette in use. */ public void addLine(float x0, float y0, float z0, float xf, float yf, float zf, float lineWidth, Color startColor, Color endColor) { MeshDataHolder lineMeshData = MeshDataGenerator.Line(x0, y0, z0, xf, yf, zf, lineWidth); float expectedDistance = 2.0f * lineWidth * lineWidth; Point3f[] vertices = lineMeshData.getVertices(); TexCoord2f[] texturePoints = lineMeshData.getTexturePoints(); Point3f start = new Point3f(x0, y0, z0); for (int i = 0; i < vertices.length; i++) { if (MathTools.epsilonEquals(vertices[i].distanceSquared(start), expectedDistance, 1.0e-5)) texturePoints[i].set(colorPalette.getTextureLocation(startColor)); else texturePoints[i].set(colorPalette.getTextureLocation(endColor)); } meshBuilder.addMesh(lineMeshData); }
distance = origin.distanceSquared(curpt);