public static DistancePointPlane ( Vector3D normalVector, Vector3D planePoint, Vector3D point ) : double | ||
normalVector | Vector3D | |
planePoint | Vector3D | |
point | Vector3D | |
return | double |
/// <summary> /// Reflect a point in us. /// </summary> public Vector3D ReflectPoint(Vector3D p) { if (IsPlane) { // We used to call ProjectOntoPlane, but optimized it away. // This is faster because we already know our normal is normalized, // and it avoids some extra Vector3D operations. double dist = Euclidean3D.DistancePointPlane(this.Normal, this.Offset, p); Vector3D offset = this.Normal * dist * -2; return(p + offset); } else { if (p == Center) { return(Infinity.InfinityVector); } if (Infinity.IsInfinite(p)) { return(Center); } Vector3D v = p - Center; double d = v.Abs(); v.Normalize(); return(Center + v * (Radius * Radius / d)); } }
public bool IsPointOn(Vector3D test) { if (IsPlane) { double dist = Euclidean3D.DistancePointPlane(this.Normal, this.Offset, test); return(Tolerance.Zero(dist)); } return(Tolerance.Equal((test - Center).Abs(), Radius)); }