Java Code Examples for javax.vecmath.Point3d#add()
The following examples show how to use
javax.vecmath.Point3d#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DragBallEntity.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
protected void renderTranslationHandle(GL2 gl2,Vector3d n) { // draw line to box gl2.glBegin(GL2.GL_LINES); gl2.glVertex3d(0,0,0); gl2.glVertex3d(n.x,n.y,n.z); gl2.glEnd(); // draw box Point3d b0 = new Point3d(+0.05,+0.05,+0.05); Point3d b1 = new Point3d(-0.05,-0.05,-0.05); b0.scale(1); b1.scale(1); b0.add(n); b1.add(n); PrimitiveSolids.drawBox(gl2, b0,b1); }
Example 2
Source File: DragBallEntity.java From Robot-Overlord-App with GNU General Public License v2.0 | 5 votes |
protected double testBoxHit(Ray ray,Vector3d n) { Point3d b0 = new Point3d(); Point3d b1 = new Point3d(); b0.set(+0.05,+0.05,+0.05); b1.set(-0.05,-0.05,-0.05); b0.scale(ballSize.get()); b1.scale(ballSize.get()); b0.add(n); b1.add(n); return MathHelper.rayBoxIntersection(ray,b0,b1); }
Example 3
Source File: CalcPoint.java From biojava with GNU Lesser General Public License v2.1 | 5 votes |
/** * Calculate the centroid of the point cloud. * * @param x * array of points. Point objects will not be modified * @return centroid as Point3d */ public static Point3d centroid(Point3d[] x) { Point3d center = new Point3d(); for (Point3d p : x) { center.add(p); } center.scale(1.0 / x.length); return center; }
Example 4
Source File: CavesExporter.java From WorldPainter with GNU General Public License v3.0 | 5 votes |
private void createTunnel(MinecraftWorld world, Dimension dimension, Random random, CaveSettings tunnelSettings, boolean surfaceBreaking, int minimumLevel) { Point3d location = new Point3d(tunnelSettings.start.x, tunnelSettings.start.y, tunnelSettings.start.z); Vector3d direction = getRandomDirection(random); final double minRadius = tunnelSettings.minRadius, maxRadius = tunnelSettings.maxRadius, radiusChangeSpeed = tunnelSettings.radiusChangeSpeed; double length = 0.0, radius = (maxRadius + minRadius) / 2.0, radiusDelta = 0.0; final int maxLength = tunnelSettings.length, twistiness = tunnelSettings.twistiness; if (logger.isTraceEnabled()) { logger.trace("Creating tunnel @ {},{},{} of length {}; radius: {} - {} (variability: {}); twistiness: {}", tunnelSettings.start.x, tunnelSettings.start.y, tunnelSettings.start.z, maxLength, tunnelSettings.minRadius, tunnelSettings.maxRadius, radiusChangeSpeed, twistiness); } while (length < maxLength) { if ((minimumLevel == 0) && (dimension.getLayerValueAt(Caves.INSTANCE, (int) location.x, (int) location.y) < 1)) { // Don't stray into areas where the layer isn't present at all return; } excavate(world, dimension, random, tunnelSettings, location, radius, surfaceBreaking); length += direction.length(); location.add(direction); final Vector3d dirChange = getRandomDirection(random); dirChange.scale(random.nextDouble() / (5 - twistiness)); direction.add(dirChange); direction.normalize(); if (radiusChangeSpeed > 0.0) { radius = MathUtils.clamp(minRadius, radius + radiusDelta, maxRadius); radiusDelta += random.nextDouble() * 2 * radiusChangeSpeed - radiusChangeSpeed; } } }
Example 5
Source File: CalcPoint.java From biojava with GNU Lesser General Public License v2.1 | 2 votes |
/** * Translate all points with a translation vector. * * @param trans * the translation vector to apply * @param x * array of points. Point objects will be modified */ public static void translate(Vector3d trans, Point3d[] x) { for (Point3d p : x) { p.add(trans); } }