コード例 #1
0
        // Handles the first face in the cut, starting from cutstart,
        // and running anticlockwise to first reference vertex
        private float PopulateSingleCutFacePositiveDirection(ref CrossSection face, OpenMetaverse.Vector3 cutPoint, int quadrant, 
            float halfCubeWidth, bool outer)
        {
            V3ToV3Xna XnaOMV = new V3ToV3Xna();
            quadrant = NormalizeQuadrant(quadrant);

            face.RemoveAllPoints();

            OpenMetaverse.Vector3 startPoint = cutPoint;
            OpenMetaverse.Vector3 endPoint;
            if (quadrant < NumberFaces - 1)
            {
                endPoint = XnaOMV.V3XToV3(ReferenceVertices[quadrant + 1] * halfCubeWidth / 0.5f);
            }
            else
            {
                endPoint = XnaOMV.V3XToV3(ReferenceVertices[0] * halfCubeWidth / 0.5f);
            }

            if (outer)
            {
                face.AddPoint(startPoint);
                face.AddPoint(endPoint);
            }
            else
            {
                face.AddPoint(endPoint);
                face.AddPoint(startPoint);
            }

            return OpenMetaverse.Vector3.Distance(startPoint, endPoint);
        }
コード例 #2
0
        private float PopulateCompleteSide(ref CrossSection face, int quadrant, float halfCubeWidth, bool outer)
        {
            V3ToV3Xna XnaOMV = new V3ToV3Xna();
            quadrant = NormalizeQuadrant(quadrant);

            face.RemoveAllPoints();

            OpenMetaverse.Vector3 startPoint = XnaOMV.V3XToV3(ReferenceVertices[quadrant]);
            OpenMetaverse.Vector3 endPoint;
            if (quadrant < NumberFaces - 1)
            {
                endPoint = XnaOMV.V3XToV3(ReferenceVertices[quadrant + 1]);
            }
            else
            {
                endPoint = XnaOMV.V3XToV3(ReferenceVertices[0]);
            }

            startPoint = startPoint * halfCubeWidth / 0.5f;
            endPoint = endPoint * halfCubeWidth / 0.5f;

            if (outer)
            {
                face.AddPoint(startPoint);
                face.AddPoint(endPoint);
            }
            else
            {
                face.AddPoint(endPoint);
                face.AddPoint(startPoint);
            }

            return 2f * halfCubeWidth;
        }