protected double PopulateSingleCutFacePositiveDirection(ref CrossSection face, GLVector3d CutPoint, int iQuadrant, double fHalfCubeWidth, bool bOuter)
        {
            iQuadrant = NormalizeQuadrant(iQuadrant);

            face.RemoveAllPoints();

            GLVector3d StartPoint = new GLVector3d(CutPoint);
            GLVector3d EndPoint   = null;

            if (iQuadrant < iNumberFaces - 1)
            {
                EndPoint = ReferenceVertices[iQuadrant + 1] * fHalfCubeWidth / 0.5;
            }
            else
            {
                EndPoint = ReferenceVertices[0] * fHalfCubeWidth / 0.5;
            }

            if (bOuter)
            {
                face.AddPoint(StartPoint);
                face.AddPoint(EndPoint);
            }
            else
            {
                face.AddPoint(EndPoint);
                face.AddPoint(StartPoint);
            }
            return((EndPoint - StartPoint).length());
        }
        protected double PopulateCompleteSide(ref CrossSection face, int iQuadrant, double fHalfCubeWidth, bool bOuter)
        {
            iQuadrant = NormalizeQuadrant(iQuadrant);

            face.RemoveAllPoints();

            GLVector3d StartPoint = ReferenceVertices[iQuadrant];
            GLVector3d EndPoint   = null;

            if (iQuadrant < iNumberFaces - 1)
            {
                EndPoint = ReferenceVertices[iQuadrant + 1];
            }
            else
            {
                EndPoint = ReferenceVertices[0];
            }

            StartPoint = StartPoint * fHalfCubeWidth / 0.5;
            EndPoint   = EndPoint * fHalfCubeWidth / 0.5;

            if (bOuter)
            {
                face.AddPoint(StartPoint.x, StartPoint.y, StartPoint.z);
                face.AddPoint(EndPoint.x, EndPoint.y, EndPoint.z);
            }
            else
            {
                face.AddPoint(EndPoint.x, EndPoint.y, EndPoint.z);
                face.AddPoint(StartPoint.x, StartPoint.y, StartPoint.z);
            }

            return(2 * fHalfCubeWidth);
        }
Example #3
0
        protected GLVector3d[] ReferenceVertices; //!< reference vertices of our prim, to build the crosssections etc

        #endregion Fields

        #region Constructors

        // constructor(s)
        public LinearPrimitive()
        {
            linearextrusionpath = new LinearExtrusionPath();
            linearextrusionpath.LevelOfDetail =  iLevelOfDetail;

            for( int i = 0; i < 4; i++ )
            {
                OuterFaces[i] = new CrossSection();
                InnerFaces[i] = new CrossSection();
            }
            CutFaces[0] = new CrossSection();
            CutFaces[1] = new CrossSection();
        }
Example #4
0
        // constructor(s)
        public LinearPrimitive()
        {
            linearextrusionpath = new LinearExtrusionPath();
            linearextrusionpath.LevelOfDetail = iLevelOfDetail;

            for (int i = 0; i < 4; i++)
            {
                OuterFaces[i] = new CrossSection();
                InnerFaces[i] = new CrossSection();
            }
            CutFaces[0] = new CrossSection();
            CutFaces[1] = new CrossSection();
        }
        // constructors

        public RotationalPrimitive()
        {
            for (int i = 0; i < 4; i++)
            {
                OuterFaces[i] = new CrossSection();
                InnerFaces[i] = new CrossSection();
            }
            CutFaces[0] = new CrossSection();
            CutFaces[1] = new CrossSection();

            rotationalextrusionpath = new RotationalExtrusionPath();
            rotationalextrusionpath.LevelOfDetail = iLevelOfDetail;

            UpdateExtrusionScaling();
        }
        // constructors
        public RotationalPrimitive()
        {
            for( int i = 0; i < 4; i++ )
            {
                OuterFaces[i] = new CrossSection();
                InnerFaces[i] = new CrossSection();
            }
            CutFaces[0] = new CrossSection();
            CutFaces[1] = new CrossSection();

            rotationalextrusionpath = new RotationalExtrusionPath();
            rotationalextrusionpath.LevelOfDetail = iLevelOfDetail;

            UpdateExtrusionScaling();
        }
Example #7
0
        // Handles the first face in the cut, starting from cutstart, and running anticlockwise to first reference vertex (assuming x points right, y points up)
        double PopulateSingleCutFacePositiveDirection( ref CrossSection face, GLVector3d CutPoint, int iQuadrant, double fHalfCubeWidth, bool bOuter )
        {
            iQuadrant = NormalizeQuadrant( iQuadrant );

            face.RemoveAllPoints();

            GLVector3d StartPoint = new GLVector3d( CutPoint );
            GLVector3d EndPoint = null;
            if( iQuadrant < iNumberFaces - 1 )
            {
                EndPoint = ReferenceVertices[ iQuadrant + 1 ] * fHalfCubeWidth / 0.5;
            }
            else
            {
                EndPoint = ReferenceVertices[ 0 ] * fHalfCubeWidth / 0.5;
            }

            if( bOuter )
            {
                face.AddPoint( StartPoint );
                face.AddPoint( EndPoint );
            }
            else
            {
                face.AddPoint( EndPoint );
                face.AddPoint( StartPoint );
            }
            return ( EndPoint - StartPoint ).length();
        }
Example #8
0
        double PopulateCompleteSide( ref CrossSection face, int iQuadrant, double fHalfCubeWidth, bool bOuter )
        {
            iQuadrant = NormalizeQuadrant( iQuadrant );

            face.RemoveAllPoints();

            GLVector3d StartPoint = ReferenceVertices[ iQuadrant ];
            GLVector3d EndPoint = null;
            if( iQuadrant < iNumberFaces - 1 )
            {
                EndPoint = ReferenceVertices[ iQuadrant + 1 ];
            }
            else
            {
                EndPoint = ReferenceVertices[ 0 ];
            }

            StartPoint = StartPoint * fHalfCubeWidth / 0.5;
            EndPoint = EndPoint * fHalfCubeWidth / 0.5;

            if( bOuter )
            {
                face.AddPoint( StartPoint.x, StartPoint.y, StartPoint.z );
                face.AddPoint( EndPoint.x, EndPoint.y, EndPoint.z );
            }
            else
            {
                face.AddPoint( EndPoint.x, EndPoint.y, EndPoint.z );
                face.AddPoint( StartPoint.x, StartPoint.y, StartPoint.z );
            }

            return 2 * fHalfCubeWidth;
        }