public static void BuildFromVertices(Vector3D a, Vector3D b, Vector3D c, Plane outPlane) { Vector3D edgeA = c.SubtractedBy(a, tempVectorA); Vector3D edgeB = b.SubtractedBy(a, tempVectorB); Vector3D cross = edgeA.Cross(edgeB, tempVectorC); // !! Important: inverted to be valid in left-handed space // TODO: make this work in either handed-ness automatically cross.Invert(); outPlane.Normal.Copy(cross); outPlane.Normal.Normalize(); outPlane.D = outPlane.Normal.Dot(a); float padding = 0.15f; outPlane.PlaneBounds.min.X = Mathf.Min(a.X, b.X, c.X) - padding; outPlane.PlaneBounds.min.Y = Mathf.Min(a.Y, b.Y, c.Y) - padding; outPlane.PlaneBounds.min.Z = Mathf.Min(a.Z, b.Z, c.Z) - padding; outPlane.PlaneBounds.max.X = Mathf.Max(a.X, b.X, c.X) + padding; outPlane.PlaneBounds.max.Y = Mathf.Max(a.Y, b.Y, c.Y) + padding; outPlane.PlaneBounds.max.Z = Mathf.Max(a.Z, b.Z, c.Z) + padding; }
public void Invert() { Normal.Invert(); D = -D; }
public void Invert() { Normal.Invert(); }
public Vector3D Inverted(Vector3D outVector) { outVector.Copy(this); outVector.Invert(); return(outVector); }
public Vector3D Inverted() { Vector3D inverted = new Vector3D(this); inverted.Invert (); return inverted; }