/** * Apply a mirror/reflection transformation to this matrix that reflects about a plane * specified via the plane orientation and a point on the plane. * <p> * This method can be used to build a reflection transformation based on the orientation of a mirror object in the scene. * It is assumed that the default mirror plane's normal is <code>(0, 0, 1)</code>. So, if the given {@link Quaterniondc} is * the identity (does not apply any additional rotation), the reflection plane will be <code>z=0</code>, offset by the given <code>point</code>. * <p> * If <code>M</code> is <code>this</code> matrix and <code>R</code> the reflection matrix, * then the new matrix will be <code>M * R</code>. So when transforming a * vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the * reflection will be applied first! * * @param orientation * the plane orientation relative to an implied normal vector of <code>(0, 0, 1)</code> * @param point * a point on the plane * @return this */ public Matrix4x3d reflect(Quaterniondc orientation, Vector3dc point) { return reflect(orientation, point, this); }
/** * Apply a mirror/reflection transformation to this matrix that reflects about a plane * specified via the plane orientation and a point on the plane. * <p> * This method can be used to build a reflection transformation based on the orientation of a mirror object in the scene. * It is assumed that the default mirror plane's normal is <code>(0, 0, 1)</code>. So, if the given {@link Quaterniondc} is * the identity (does not apply any additional rotation), the reflection plane will be <code>z=0</code>, offset by the given <code>point</code>. * <p> * If <code>M</code> is <code>this</code> matrix and <code>R</code> the reflection matrix, * then the new matrix will be <code>M * R</code>. So when transforming a * vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the * reflection will be applied first! * * @param orientation * the plane orientation relative to an implied normal vector of <code>(0, 0, 1)</code> * @param point * a point on the plane * @return this */ public Matrix4x3d reflect(Quaterniondc orientation, Vector3dc point) { return reflect(orientation, point, this); }
/** * Apply a mirror/reflection transformation to this matrix that reflects about the given plane * specified via the equation <code>x*a + y*b + z*c + d = 0</code>. * <p> * The vector <code>(a, b, c)</code> must be a unit vector. * <p> * If <code>M</code> is <code>this</code> matrix and <code>R</code> the reflection matrix, * then the new matrix will be <code>M * R</code>. So when transforming a * vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the * reflection will be applied first! * <p> * Reference: <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb281733(v=vs.85).aspx">msdn.microsoft.com</a> * * @param a * the x factor in the plane equation * @param b * the y factor in the plane equation * @param c * the z factor in the plane equation * @param d * the constant in the plane equation * @return this */ public Matrix4x3d reflect(double a, double b, double c, double d) { return reflect(a, b, c, d, this); }
/** * Apply a mirror/reflection transformation to this matrix that reflects about the given plane * specified via the plane normal and a point on the plane. * <p> * If <code>M</code> is <code>this</code> matrix and <code>R</code> the reflection matrix, * then the new matrix will be <code>M * R</code>. So when transforming a * vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the * reflection will be applied first! * * @param nx * the x-coordinate of the plane normal * @param ny * the y-coordinate of the plane normal * @param nz * the z-coordinate of the plane normal * @param px * the x-coordinate of a point on the plane * @param py * the y-coordinate of a point on the plane * @param pz * the z-coordinate of a point on the plane * @return this */ public Matrix4x3d reflect(double nx, double ny, double nz, double px, double py, double pz) { return reflect(nx, ny, nz, px, py, pz, this); }
/** * Apply a mirror/reflection transformation to this matrix that reflects about the given plane * specified via the plane normal and a point on the plane. * <p> * If <code>M</code> is <code>this</code> matrix and <code>R</code> the reflection matrix, * then the new matrix will be <code>M * R</code>. So when transforming a * vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the * reflection will be applied first! * * @param nx * the x-coordinate of the plane normal * @param ny * the y-coordinate of the plane normal * @param nz * the z-coordinate of the plane normal * @param px * the x-coordinate of a point on the plane * @param py * the y-coordinate of a point on the plane * @param pz * the z-coordinate of a point on the plane * @return this */ public Matrix4x3d reflect(double nx, double ny, double nz, double px, double py, double pz) { return reflect(nx, ny, nz, px, py, pz, this); }
/** * Apply a mirror/reflection transformation to this matrix that reflects about the given plane * specified via the equation <code>x*a + y*b + z*c + d = 0</code>. * <p> * The vector <code>(a, b, c)</code> must be a unit vector. * <p> * If <code>M</code> is <code>this</code> matrix and <code>R</code> the reflection matrix, * then the new matrix will be <code>M * R</code>. So when transforming a * vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the * reflection will be applied first! * <p> * Reference: <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb281733(v=vs.85).aspx">msdn.microsoft.com</a> * * @param a * the x factor in the plane equation * @param b * the y factor in the plane equation * @param c * the z factor in the plane equation * @param d * the constant in the plane equation * @return this */ public Matrix4x3d reflect(double a, double b, double c, double d) { return reflect(a, b, c, d, this); }
public Matrix4x3d reflect(double nx, double ny, double nz, double px, double py, double pz, Matrix4x3d dest) { double invLength = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz); double nnx = nx * invLength; double nny = ny * invLength; double nnz = nz * invLength; /* See: http://mathworld.wolfram.com/Plane.html */ return reflect(nnx, nny, nnz, -nnx * px - nny * py - nnz * pz, dest); }
public Matrix4x3d reflect(double nx, double ny, double nz, double px, double py, double pz, Matrix4x3d dest) { double invLength = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz); double nnx = nx * invLength; double nny = ny * invLength; double nnz = nz * invLength; /* See: http://mathworld.wolfram.com/Plane.html */ return reflect(nnx, nny, nnz, -nnx * px - nny * py - nnz * pz, dest); }
public Matrix4x3d reflect(Vector3dc normal, Vector3dc point, Matrix4x3d dest) { return reflect(normal.x(), normal.y(), normal.z(), point.x(), point.y(), point.z(), dest); }
public Matrix4x3d reflect(Vector3dc normal, Vector3dc point, Matrix4x3d dest) { return reflect(normal.x(), normal.y(), normal.z(), point.x(), point.y(), point.z(), dest); }
/** * Apply a mirror/reflection transformation to this matrix that reflects about the given plane * specified via the plane normal and a point on the plane. * <p> * If <code>M</code> is <code>this</code> matrix and <code>R</code> the reflection matrix, * then the new matrix will be <code>M * R</code>. So when transforming a * vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the * reflection will be applied first! * * @param normal * the plane normal * @param point * a point on the plane * @return this */ public Matrix4x3d reflect(Vector3dc normal, Vector3dc point) { return reflect(normal.x(), normal.y(), normal.z(), point.x(), point.y(), point.z()); }
/** * Apply a mirror/reflection transformation to this matrix that reflects about the given plane * specified via the plane normal and a point on the plane. * <p> * If <code>M</code> is <code>this</code> matrix and <code>R</code> the reflection matrix, * then the new matrix will be <code>M * R</code>. So when transforming a * vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the * reflection will be applied first! * * @param normal * the plane normal * @param point * a point on the plane * @return this */ public Matrix4x3d reflect(Vector3dc normal, Vector3dc point) { return reflect(normal.x(), normal.y(), normal.z(), point.x(), point.y(), point.z()); }
public Matrix4x3d reflect(Quaterniondc orientation, Vector3dc point, Matrix4x3d dest) { double num1 = orientation.x() + orientation.x(); double num2 = orientation.y() + orientation.y(); double num3 = orientation.z() + orientation.z(); double normalX = orientation.x() * num3 + orientation.w() * num2; double normalY = orientation.y() * num3 - orientation.w() * num1; double normalZ = 1.0 - (orientation.x() * num1 + orientation.y() * num2); return reflect(normalX, normalY, normalZ, point.x(), point.y(), point.z(), dest); }
public Matrix4x3d reflect(Quaterniondc orientation, Vector3dc point, Matrix4x3d dest) { double num1 = orientation.x() + orientation.x(); double num2 = orientation.y() + orientation.y(); double num3 = orientation.z() + orientation.z(); double normalX = orientation.x() * num3 + orientation.w() * num2; double normalY = orientation.y() * num3 - orientation.w() * num1; double normalZ = 1.0 - (orientation.x() * num1 + orientation.y() * num2); return reflect(normalX, normalY, normalZ, point.x(), point.y(), point.z(), dest); }