예제 #1
0
        private static Ray ComputeIntersectionLine(ref Plane p1, ref Plane p2)
        {
            Ray ray = new Ray();

            ray.Direction = Vector3.Cross(p1.Normal, p2.Normal);
            float num = ray.Direction.LengthSquared();

            ray.Position = Vector3.Cross(-p1.D * p2.Normal + p2.D * p1.Normal, ray.Direction) / num;
            return(ray);
        }
예제 #2
0
        //  Points specified so that pt1-pt0 is edge0 and p2-pt0 is edge1
        public void Update(ref Vector3 vertex0, ref Vector3 vertex1, ref Vector3 vertex2)
        {
            Vertex0 = vertex0;
            Vertex1 = vertex1;
            Vertex2 = vertex2;

            Plane = new VRageMath.Plane(Vertex0, Vertex1, Vertex2);

            m_origin = vertex0;
            m_edge0  = vertex1 - vertex0;
            m_edge1  = vertex2 - vertex0;

            m_normal = Vector3.Cross(m_edge0, m_edge1);
            m_normal.Normalize();
        }
예제 #3
0
 private static Ray ComputeIntersectionLine(ref Plane p1, ref Plane p2)
 {
     Ray ray = new Ray();
     ray.Direction = Vector3.Cross(p1.Normal, p2.Normal);
     float num = ray.Direction.LengthSquared();
     ray.Position = Vector3.Cross(-p1.D * p2.Normal + p2.D * p1.Normal, ray.Direction) / num;
     return ray;
 }
예제 #4
0
        //  Points specified so that pt1-pt0 is edge0 and p2-pt0 is edge1
        public void Update(ref Vector3 vertex0, ref Vector3 vertex1, ref Vector3 vertex2)
        {
            Vertex0 = vertex0;
            Vertex1 = vertex1;
            Vertex2 = vertex2;

            Plane = new VRageMath.Plane(Vertex0, Vertex1, Vertex2);

            m_origin = vertex0;
            m_edge0 = vertex1 - vertex0;
            m_edge1 = vertex2 - vertex0;

            m_normal = Vector3.Cross(m_edge0, m_edge1);
            m_normal.Normalize();
        }