Exemple #1
0
        /// <summary>
        /// This method constructs the winder corner and two straight runs.
        /// Please be sure the input properties being set properly before calling this method.
        /// </summary>
        private void Construct()
        {
            //
            // Construct the winder corner.
            //
            XYZ dir1 = (ControlPoints[1] - ControlPoints[0]).Normalize();
            XYZ dir2 = (ControlPoints[2] - ControlPoints[1]).Normalize();

            m_corner = new WinderSinglePoint(ControlPoints[1], dir1, dir2, NumStepsInCorner);
            m_corner.Construct(RunWidth, CenterOffsetE, CenterOffsetF);

            //
            // Construct two straight runs to connect to the winder corner.
            //
            XYZ startPnt          = m_corner.StartPoint - TreadDepth * NumStepsAtStart * dir1;
            XYZ endPnt            = m_corner.EndPoint + TreadDepth * NumStepsAtEnd * dir2;
            XYZ bisectDir         = (dir2 - dir1).Normalize();
            XYZ perpendicularDir1 = new XYZ(-dir1.Y, dir1.X, 0);
            XYZ perpendicularDir2 = new XYZ(-dir2.Y, dir2.X, 0);

            if (bisectDir.DotProduct(perpendicularDir1) < 0)
            {
                perpendicularDir1 = perpendicularDir1.Negate();
                perpendicularDir2 = perpendicularDir2.Negate();
            }
            m_straightAtStart = new WinderStraight(
                startPnt, m_corner.StartPoint, perpendicularDir1, NumStepsAtStart);
            m_straightAtEnd = new WinderStraight(
                m_corner.EndPoint, endPnt, perpendicularDir2, NumStepsAtEnd);
        }
Exemple #2
0
        /// <summary>
        /// This method constructs two winder corners and three straight runs.
        /// Please be sure the input properties being set properly before calling this method.
        /// </summary>
        private void Construct()
        {
            //
            // Construct the first winder corner
            //
            XYZ dir1 = (ControlPoints[1] - ControlPoints[0]).Normalize();
            XYZ dir2 = (ControlPoints[2] - ControlPoints[1]).Normalize();

            m_corner1st = new WinderSinglePoint(ControlPoints[1], dir1, dir2, NumStepsInCorner1);
            m_corner1st.Construct(RunWidth, CenterOffsetE1, CenterOffsetF1);

            //
            // Construct the second winder corner
            //
            XYZ dir3 = (ControlPoints[3] - ControlPoints[2]).Normalize();

            m_corner2nd = new WinderSinglePoint(ControlPoints[1], dir2, dir3, NumStepsInCorner2);
            m_corner2nd.Construct(RunWidth, CenterOffsetF2, CenterOffsetE2);
            XYZ moveDelta = (m_corner1st.Distance2 + m_corner2nd.Distance1
                             + TreadDepth * NumStepsInMiddle) * dir2;

            m_corner2nd.Move(moveDelta);

            //
            // Construct the three straight runs
            //
            XYZ startPnt          = m_corner1st.StartPoint - TreadDepth * NumStepsAtStart * dir1;
            XYZ endPnt            = m_corner2nd.EndPoint + TreadDepth * NumStepsAtEnd * dir3;
            XYZ bisectDir         = (dir2 - dir1).Normalize();
            XYZ perpendicularDir1 = new XYZ(-dir1.Y, dir1.X, 0);
            XYZ perpendicularDir2 = new XYZ(-dir2.Y, dir2.X, 0);
            XYZ perpendicularDir3 = new XYZ(-dir3.Y, dir3.X, 0);

            if (bisectDir.DotProduct(perpendicularDir1) < 0)
            {
                perpendicularDir1 = perpendicularDir1.Negate();
                perpendicularDir2 = perpendicularDir2.Negate();
                perpendicularDir3 = perpendicularDir3.Negate();
            }
            m_straightAtStart = new WinderStraight(
                startPnt, m_corner1st.StartPoint, perpendicularDir1, NumStepsAtStart);
            m_straightInMiddle = new WinderStraight(
                m_corner1st.EndPoint, m_corner2nd.StartPoint, perpendicularDir2, NumStepsInMiddle);
            m_straightAtEnd = new WinderStraight(
                m_corner2nd.EndPoint, endPnt, perpendicularDir3, NumStepsAtEnd);
        }