/** * Returns the resulting matrix from vector1*transpose(vector2) * * @param vector1 * @param vector2 */ public static Matrix3d vectorTimesVectorTranspose(Vector3d vector1, Vector3d vector2) { Matrix3d matrix = new Matrix3d(); double[] array1 = new double[3]; double[] array2 = new double[3]; vector1.get(array1); vector2.get(array2); for (int row = 0; row < 3; row++) { for (int column = 0; column < 3; column++) { matrix.setElement(row, column, array1[row] * array2[column]); } } return matrix; }
protected final void makeNormal() { normal = new Vector3d(); normal.cross(row, column); normal.normalize(); normalArray = new double[3]; normal.get(normalArray); // depends of vector system (right/left-handed system): normalArray[2] = normalArray[2] * -1 normal = new Vector3d(normalArray); }
public static void shootTreeIntoSphere(Octree tree, double radius, double shootingDistance, double xCenter, double yCenter, double zCenter, int numberOfLidarBullets) { Random rand = new Random(-1985L); double[] centerAsArray = new double[] { xCenter, yCenter, zCenter }; double[] startPointAsArray = new double[3]; double[] endPointAsArray = new double[3]; double[] vectorAsArray = new double[3]; double radiusToShootFrom = shootingDistance; for (int k = 0; k < numberOfLidarBullets; k++) { Vector3d vector3d = RandomTools.generateRandomVector(rand, 1.0); vector3d.get(vectorAsArray); for (int j = 0; j < 3; j++) { startPointAsArray[j] = vectorAsArray[j] * radiusToShootFrom + centerAsArray[j]; endPointAsArray[j] = vectorAsArray[j] * radius + centerAsArray[j]; } Point3d start = new Point3d(startPointAsArray); Point3d end = new Point3d(endPointAsArray); tree.putLidarAtGraduallyMoreAccurateResolution(start, end); } // tree.mergeIfPossible(); }