/// <summary> /// Computes the oriented distance from a point to the plane.<br/> /// The distance is: /// <list type="Bullet"> /// <item><b>positive</b> if the point lies above the plane (relative to the plane normal)</item> /// <item><b>zero</b> if the point is on the plane</item> /// <item><b>negative</b> if the point lies below the plane (relative to the plane normal)</item> /// </list> /// </summary> /// <param name="p">The point to compute the distance for</param> /// <returns>The oriented distance to the plane</returns> public double OrientedDistance(Coordinate p) { var pb = new Vector3D(p, _basePt); var pbdDotNormal = pb.Dot(_normal); if (Double.IsNaN(pbdDotNormal)) throw new ArgumentException("3D Coordinate has NaN ordinate"); var d = pbdDotNormal/_normal.Length(); return d; }
public Plane3D(Vector3D normal, Coordinate basePt) { _normal = normal; _basePt = basePt; }
/// <summary> /// Computes the dot-product of this <see cref="Vector3D"/> and <paramref name="v"/> /// </summary> /// <paramref name="v">The 2nd vector</paramref> /// <returns>The dot product of the vectors</returns> public double Dot(Vector3D v) { return _x * v._x + _y * v._y + _z * v._z; }