CSG.Vector3D.Invert C# (CSharp) Method

Invert() public method

public Invert ( ) : void
return void
        public void Invert()
        {
            X = -X;
            Y = -Y;
            Z = -Z;
        }

Usage Example

Beispiel #1
0
        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;
        }
All Usage Examples Of CSG.Vector3D::Invert