Exemplo n.º 1
0
  public final boolean isIntersected(final Vector3f v0, final Vector3f v1, final Vector3f v2) {
    final Vector3f v01 = v1.sub(v0);
    final Vector3f v02 = v2.sub(v0);

    final Vector3f pvec = this.direction().cross(v02);

    final float det = v01.dot(pvec);

    if (det > 1e-6f) {
      final Vector3f tvec = this.from().sub(v0);
      final float u = tvec.dot(pvec);
      if (u < 0.0f || u > det) {
        return (false);
      }

      final Vector3f qvec = tvec.cross(v01);
      final float v = this.direction().dot(qvec);
      if (v < 0.0f || u + v > det) {
        return (false);
      }

      final float t = v02.dot(qvec) / det;
      this.setT(t);

      return (true); // hit!!
    }

    return (false);
  }
Exemplo n.º 2
0
 public SlicePlane(Vector3f point, Vector3f norm, TransferFunction transfer_function) {
   super(transfer_function);
   m_coefficients = new Vector4f(norm, -point.dot(norm));
 }
Exemplo n.º 3
0
 public SlicePlane(Vector3f point, Vector3f norm) {
   super();
   m_coefficients = new Vector4f(norm, -point.dot(norm));
 }