示例#1
0
        public static void CreateSub()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(15.0, 14.0, -2.0, 2.0, -1.0);

            msgTorus        tor1    = msgTorus.Create(2, 1, 24, 24);
            msgTorus        tor2    = msgTorus.Create(2, 0.8, 24, 24);
            msgVectorStruct transV1 = new msgVectorStruct(1, 1, 0);

            tor2.InitTempMatrix().Translate(transV1);
            tor2.ApplyTempMatrix();
            tor2.DestroyTempMatrix();
            scene.AttachObject(tor1);
            tor1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 5);
            scene.AttachObject(tor2);
            tor2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 25);

            msgVectorStruct transV2 = new msgVectorStruct(-6.0, 0, 0);

            msgGroup bool1 = msgBoolean.Sub(tor1, tor2);

            bool1.InitTempMatrix().Translate(transV2);
            bool1.ApplyTempMatrix();
            bool1.DestroyTempMatrix();
            scene.AttachObject(bool1);
            bool1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 3);
        }
示例#2
0
        public static void CreateIntersectionContours()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgTorus        tor1    = msgTorus.Create(2, 1, 36, 36);
            msgTorus        tor2    = msgTorus.Create(2, 0.6, 36, 36);
            msgVectorStruct transV1 = new msgVectorStruct(1, 1, 0);

            tor2.InitTempMatrix().Translate(transV1);
            tor2.ApplyTempMatrix();
            tor2.DestroyTempMatrix();
            scene.AttachObject(tor1);
            tor1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 65);
            scene.AttachObject(tor2);
            tor2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 105);

            msgVectorStruct transV2 = new msgVectorStruct(5, 0, 0.0);

            msgGroup bool1 = msgBoolean.IntersectionContour(tor1, tor2);

            bool1.InitTempMatrix().Translate(transV2);
            bool1.ApplyTempMatrix();
            bool1.DestroyTempMatrix();
            scene.AttachObject(bool1);
            bool1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            bool1.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);
        }
示例#3
0
        public static void CreateSpiralSurface()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgArcStruct   ArcGeo = new msgArcStruct();
            msgPointStruct ArP1   = new msgPointStruct(-1.0, -3.0, 0.0);
            msgPointStruct ArP2   = new msgPointStruct(-1.0, -2.0, 0.0);
            msgPointStruct ArP3   = new msgPointStruct(0.0, -3.5, 0.0);

            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            msg2DObject ar = msgArc.Create(ArcGeo);

            scene.AttachObject(ar);
            ar.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            ar.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgPointStruct axeP1 = new msgPointStruct(2.0, -3.0, 0.0);
            msgPointStruct axeP2 = new msgPointStruct(2.0, 3.0, 0.0);

            msg3DObject spirO = (msg3DObject)msgKinematic.Spiral(ar, null, axeP1, axeP2, 4, 10, 15, false);

            scene.AttachObject(spirO);
            spirO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 85);

            msgVectorStruct transV1 = new msgVectorStruct(0, -11.5, 0);

            spirO.InitTempMatrix().Translate(transV1);
            spirO.ApplyTempMatrix();
            spirO.DestroyTempMatrix();
        }
示例#4
0
        public static void CreateUnion()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgTorus tor1 = msgTorus.Create(2, 1, 24, 24);
            msgTorus tor2 = msgTorus.Create(2, 0.5, 24, 24);

            msgVectorStruct transV1 = new msgVectorStruct(1, 3.5, 0);

            tor2.InitTempMatrix().Translate(transV1);
            tor2.ApplyTempMatrix();
            tor2.DestroyTempMatrix();
            scene.AttachObject(tor1);
            tor1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 5);
            scene.AttachObject(tor2);
            tor2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 45);

            msgVectorStruct transV2 = new msgVectorStruct(-6.5, 0, 0);

            msgGroup bool1 = msgBoolean.Union(tor1, tor2);

            bool1.InitTempMatrix().Translate(transV2);
            bool1.ApplyTempMatrix();
            bool1.DestroyTempMatrix();
            scene.AttachObject(bool1);
            bool1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 3);
            bool1.SetAttribute(msgObjectAttrEnum.SG_OA_DRAW_STATE, (ushort)SG_OA_DRAW_STATEValuesEnum.SGDS_FRAME);
        }
示例#5
0
        public static void CreateCylinders()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(80.0, 50.0, 20.0, 10.0, 5.0);

            for (ushort i = 2; i < 8; i++)
            {
                msgCylinder     cy1     = msgCylinder.Create(i, 2 * i, 24);
                msgVectorStruct transV1 = new msgVectorStruct(5 * i, 10, 10);
                cy1.InitTempMatrix().Translate(transV1);
                cy1.ApplyTempMatrix();
                cy1.DestroyTempMatrix();

                scene.AttachObject(cy1);
                cy1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, i);

                if (i % 2 > 0)
                {
                    cy1.SetAttribute(msgObjectAttrEnum.SG_OA_DRAW_STATE, (ushort)SG_OA_DRAW_STATEValuesEnum.SGDS_FRAME);
                }
            }
        }
示例#6
0
        public static void CreateSpheres()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(20.0, 10.0, 0.0, 1.0, -2.0);

            for (ushort i = 3; i < 5; i++)
            {
                msgSphere sp1 = msgSphere.Create(i, 24, 24);

                msgVectorStruct transV1 = new msgVectorStruct(5 * (i - 3), 2, 0);
                sp1.InitTempMatrix().Translate(transV1);
                sp1.ApplyTempMatrix();
                sp1.DestroyTempMatrix();

                scene.AttachObject(sp1);
                sp1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, i);
                if (i % 2 > 0)
                {
                    sp1.SetAttribute(msgObjectAttrEnum.SG_OA_DRAW_STATE, (ushort)SG_OA_DRAW_STATEValuesEnum.SGDS_FRAME);
                }
            }
        }
示例#7
0
        public static void CreateMesh()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            short x_sz = 20;
            short y_sz = 20;

            msgPointStruct[] pnts = new msgPointStruct[x_sz * y_sz];

            for (short i = 0; i < x_sz; i++)
            {
                for (short j = 0; j < y_sz; j++)
                {
                    pnts[i * y_sz + j]   = new msgPointStruct();
                    pnts[i * y_sz + j].x = i - x_sz / 2;
                    pnts[i * y_sz + j].y = j - y_sz / 2;
                    pnts[i * y_sz + j].z = 0.1 * (pnts[i * y_sz + j].x * pnts[i * y_sz + j].x +
                                                  pnts[i * y_sz + j].y * pnts[i * y_sz + j].y);
                }
            }

            msgObject msh = msgSurfaces.Mesh(x_sz, y_sz, pnts);

            scene.AttachObject(msh);
            msh.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 30);
            msh.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);
        }
示例#8
0
        public static void CreateSections()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgTorus tor1 = msgTorus.Create(2, 1, 36, 36);

            scene.AttachObject(tor1);

            msgVectorStruct transV2 = new msgVectorStruct(-6, 0, 0);

            for (int i = -30; i < 30; i += 4)
            {
                msgVectorStruct plN = new msgVectorStruct();
                plN.x = 0.0; plN.y = 1.0; plN.z = 1.0;

                msgGroup bool1 = msgBoolean.Section(tor1, plN, 0.1 * i);

                if (bool1 != null)
                {
                    bool1.InitTempMatrix().Translate(transV2);
                    bool1.ApplyTempMatrix();
                    bool1.DestroyTempMatrix();
                    scene.AttachObject(bool1);
                    bool1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, (ushort)(i + 50));
                    bool1.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);
                }
            }
        }
示例#9
0
        public static void CreateBoxes()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(7.0, 7.0, 1.0, 1.0, -0.3);

            msgBox bx1 = msgBox.Create(1, 2, 2.1);

            scene.AttachObject(bx1);
            bx1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 8);

            msgBox bx2 = msgBox.Create(1, 1, 1);

            msgVectorStruct transV = new msgVectorStruct();

            transV.x = 1.5;
            transV.y = 0.0;
            transV.z = 0.0;
            bx2.InitTempMatrix().Translate(transV);
            bx2.ApplyTempMatrix();
            bx2.DestroyTempMatrix();

            bx2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            bx2.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);
            bx2.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_TYPE, 1);

            scene.AttachObject(bx2);
        }
示例#10
0
        public static void CreateExtrudeBody()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(30.0, 25.0, -2.0, 0.0, -2.0);

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl2 = msgSplineStruct.Create();
            int             fl   = 0;

            for (double i = 0.0; i < 2.0 * 3.14159265; i += 0.13)
            {
                tmpPnt.x = ((double)(fl % 3 + 2)) * Math.Cos(i);
                tmpPnt.y = ((double)(fl % 3 + 2)) * Math.Sin(i);
                tmpPnt.z = 0.0;
                spl2.AddKnot(tmpPnt, fl);
                fl++;
            }
            spl2.Close();

            msgSpline spl2_obj = msgSpline.Create(spl2);

            msgSplineStruct.Delete(spl2);
            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgCircleStruct cirGeo = new msgCircleStruct();
            msgPointStruct  cirC   = new msgPointStruct(0.0, 0.0, 0.0);
            msgVectorStruct cirNor = new msgVectorStruct(0.0, 0.0, 1.0);

            cirGeo.FromCenterRadiusNormal(cirC, 1.6, cirNor);
            msg2DObject cir = msgCircle.Create(cirGeo);

            scene.AttachObject(cir);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgVectorStruct extVec = new msgVectorStruct(1, -2, 5);

            msg3DObject exO = (msg3DObject)msgKinematic.Extrude(spl2_obj, new msg2DObject[] { cir }, extVec, true);

            scene.AttachObject(exO);
            exO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 30);

            msgVectorStruct transV1 = new msgVectorStruct(-7, 0, 0);

            exO.InitTempMatrix().Translate(transV1);
            exO.ApplyTempMatrix();
            exO.DestroyTempMatrix();
        }
示例#11
0
        public static void CreateRotationSurface()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(15.0, 14.0, -2.0, 2.0, -3.0);

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl2 = msgSplineStruct.Create();

            tmpPnt.x = 1.0; tmpPnt.y = -3.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 0);
            tmpPnt.x = 3.0; tmpPnt.y = -2.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 1);
            tmpPnt.x = 2.0; tmpPnt.y = -1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 2);
            tmpPnt.x = 3.0; tmpPnt.y = 1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 3);
            tmpPnt.x = 2.0; tmpPnt.y = 4.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 4);
            tmpPnt.x = 4.0; tmpPnt.y = 5.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 5);

            msgSpline spl2_obj = msgSpline.Create(spl2);

            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgSplineStruct.Delete(spl2);

            msgPointStruct p1 = new msgPointStruct(0, -2, 0);
            msgPointStruct p2 = new msgPointStruct(0, 0, 0);

            msg3DObject rO = (msg3DObject)msgKinematic.Rotation(spl2_obj, p1, p2, 250, false);

            scene.AttachObject(rO);
            rO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 3);

            msgVectorStruct transV1 = new msgVectorStruct(-1, 0, 0);

            rO.InitTempMatrix().Translate(transV1);
            rO.ApplyTempMatrix();
            rO.DestroyTempMatrix();
        }
示例#12
0
        public static void CreateRotationBody()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl2 = msgSplineStruct.Create();
            int             fl   = 0;

            for (double i = 0.0; i < 2.0 * Math.PI; i += 0.4)
            {
                tmpPnt.x = ((double)(fl % 3 + 2)) * Math.Cos(i);
                tmpPnt.y = ((double)(fl % 3 + 2)) * Math.Sin(i);
                tmpPnt.z = 0.0;
                spl2.AddKnot(tmpPnt, fl);
                fl++;
            }

            spl2.Close();

            msgSpline spl2_obj = msgSpline.Create(spl2);

            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgSplineStruct.Delete(spl2);

            msgPointStruct p1 = new msgPointStruct(10, 10, 0);
            msgPointStruct p2 = new msgPointStruct(20, 15, 0);

            msg3DObject rO = (msg3DObject)msgKinematic.Rotation(spl2_obj, p1, p2, 290, true);

            scene.AttachObject(rO);
            rO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 8);

            msgVectorStruct transV1 = new msgVectorStruct(-6, 0, 0);

            rO.InitTempMatrix().Translate(transV1);
            rO.ApplyTempMatrix();
            rO.DestroyTempMatrix();
        }
示例#13
0
        public static void CreateSpiralBody()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgCircleStruct cirGeo1 = new msgCircleStruct();
            msgPointStruct  cirC1   = new msgPointStruct(2.0, -2.0, 0.0);
            msgVectorStruct cirNor1 = new msgVectorStruct(0.0, 0.0, 1.0);

            cirGeo1.FromCenterRadiusNormal(cirC1, 3.0, cirNor1);
            msg2DObject cir1 = msgCircle.Create(cirGeo1);

            scene.AttachObject(cir1);
            cir1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir1.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgCircleStruct cirGeo2 = new msgCircleStruct();
            msgPointStruct  cirC2   = new msgPointStruct(2.0, -2.3, 0.0);
            msgVectorStruct cirNor2 = new msgVectorStruct(0.0, 0.0, 1.0);

            cirGeo2.FromCenterRadiusNormal(cirC2, 1.5, cirNor2);
            msg2DObject cir2 = msgCircle.Create(cirGeo2);

            scene.AttachObject(cir2);
            cir2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir2.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgPointStruct axeP1 = new msgPointStruct(6.0, -3.0, 0.0);
            msgPointStruct axeP2 = new msgPointStruct(6.0, 3.0, 0.0);

            msg3DObject spirO = (msg3DObject)msgKinematic.Spiral(cir1, new msg2DObject[] { cir2 }, axeP1, axeP2, 12, 30, 16, true);

            scene.AttachObject(spirO);
            spirO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 56);

            msgVectorStruct transV1 = new msgVectorStruct(0, 7, 0);

            spirO.InitTempMatrix().Translate(transV1);
            spirO.ApplyTempMatrix();
            spirO.DestroyTempMatrix();
        }
示例#14
0
        public static void CreateExtrudeSurfaces()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl2 = msgSplineStruct.Create();

            int fl = 0;

            for (double i = 0.0; i < 10.0; i += 1.0)
            {
                tmpPnt.x = i;
                tmpPnt.y = (fl % 2 > 0)?-i / 2.0:i / 2.0;
                tmpPnt.z = 0.0;
                spl2.AddKnot(tmpPnt, fl);
                fl++;
            }

            msgSpline spl2_obj = msgSpline.Create(spl2);

            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgSplineStruct.Delete(spl2);

            msgVectorStruct extVec = new msgVectorStruct(1, -2, 3);

            msg3DObject exO = (msg3DObject)msgKinematic.Extrude(spl2_obj, null, extVec, false);

            scene.AttachObject(exO);
            exO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 20);

            msgVectorStruct transV1 = new msgVectorStruct(8, 0, 0);

            exO.InitTempMatrix().Translate(transV1);
            exO.ApplyTempMatrix();
            exO.DestroyTempMatrix();
        }
示例#15
0
        public static void CreateBands()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(40.0, 40.0, 15.0, 10.0, 0.0);

            for (ushort i = 2; i < 5; i++)
            {
                msgSphericBand  sb1     = msgSphericBand.Create(i, -0.4, 0.5, 24);
                msgVectorStruct transV1 = new msgVectorStruct(5 * i, 10, 10);
                sb1.InitTempMatrix().Translate(transV1);
                sb1.ApplyTempMatrix();
                sb1.DestroyTempMatrix();

                scene.AttachObject(sb1);
                sb1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, i);
            }
        }
示例#16
0
        public static void CreateCones()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(200.0, 100.0, 50.0, 10.0, 5.0);

            for (ushort i = 2; i < 10; i++)
            {
                msgCone         co1     = msgCone.Create(i, i / 3, 10 * i, 36);
                msgVectorStruct transV1 = new msgVectorStruct(10 * i, 10, 10);
                co1.InitTempMatrix().Translate(transV1);
                co1.ApplyTempMatrix();
                co1.DestroyTempMatrix();

                scene.AttachObject(co1);
                co1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, i);
            }
        }
示例#17
0
        public static void CreateEllipsoids()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(100.0, 50.0, 50.0, 10.0, 2.0);
            Random rand = new Random();

            for (ushort i = 3; i < 10; i++)
            {
                msgEllipsoid    ell1   = msgEllipsoid.Create(i, i / 6 + 2, 2 * i, 24, 24);
                msgPointStruct  rotCen = new msgPointStruct(0.0, 0.0, 0.0);
                msgVectorStruct rotDir = new msgVectorStruct(rand.Next(), rand.Next(), rand.Next());
                ell1.InitTempMatrix().Rotate(rotCen, rotDir, rand.Next() * 360);
                msgVectorStruct transV1 = new msgVectorStruct(10 * i, 10, 10);
                ell1.GetTempMatrix().Translate(transV1);
                ell1.ApplyTempMatrix();
                ell1.DestroyTempMatrix();

                scene.AttachObject(ell1);
                ell1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, i);
            }
        }
示例#18
0
        public static void CreateBodyFromClips()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(20.0, 20.0, 5.0, 2.0, -4.0);

            msgPointStruct  tmpPnt = new msgPointStruct();
            msgSplineStruct spl1   = msgSplineStruct.Create();
            int             fl     = 0;

            for (double i = 0.0; i < 2.0 * 3.14159265; i += 0.4)
            {
                tmpPnt.x = ((double)(fl % 3 + 2)) * Math.Cos(i);
                tmpPnt.y = ((double)(fl % 3 + 2)) * Math.Sin(i);
                tmpPnt.z = 0.0;
                spl1.AddKnot(tmpPnt, fl);
                fl++;
            }
            spl1.Close();

            msgSpline spl1_obj = msgSpline.Create(spl1);

            msgSplineStruct.Delete(spl1);
            scene.AttachObject(spl1_obj);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgSplineStruct spl2 = msgSplineStruct.Create();

            tmpPnt.x = 0.0; tmpPnt.y = -0.9; tmpPnt.z = 2.0;
            spl2.AddKnot(tmpPnt, 0);
            tmpPnt.x = 1.4; tmpPnt.y = 0.9; tmpPnt.z = 2.0;
            spl2.AddKnot(tmpPnt, 1);
            tmpPnt.x = -1.6; tmpPnt.y = 0.6; tmpPnt.z = 2.0;
            spl2.AddKnot(tmpPnt, 2);
            tmpPnt.x = -1.2; tmpPnt.y = -1.6; tmpPnt.z = 2.0;
            spl2.AddKnot(tmpPnt, 3);
            spl2.Close();

            msgSpline spl2_obj = msgSpline.Create(spl2);

            msgSplineStruct.Delete(spl2);
            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            scene.AttachObject(spl1_obj);
            scene.AttachObject(spl2_obj);

            msg2DObject[] ooo = new msg2DObject[3];
            ooo[1] = spl1_obj;
            ooo[0] = spl2_obj;
            ooo[2] = (msg2DObject)spl2_obj.Clone();

            scene.AttachObject(ooo[2]);

            msgPointStruct  axeP = new msgPointStruct(0.0, 0.0, 0.0);
            msgVectorStruct axeD = new msgVectorStruct(0.0, 0.0, 1.0);

            axeD.z = 0.0; axeD.x = 1.0;
            ooo[2].InitTempMatrix().Rotate(axeP, axeD, Math.PI / 4.0);
            msgVectorStruct trV = new msgVectorStruct(-1.0, 1.0, -3.0);

            ooo[2].GetTempMatrix().Translate(trV);
            ooo[2].ApplyTempMatrix();
            ooo[2].DestroyTempMatrix();

            double[] ppp = new double[3];
            ppp[0] = 0.1;
            ppp[1] = 0.0;
            ppp[2] = 0.2;


            msgObject lsf = msgSurfaces.SplineSurfaceFromSections(ooo, ppp, true);

            scene.AttachObject(lsf);
            lsf.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 23);

            msgVectorStruct transV1 = new msgVectorStruct(8, 0, 0);

            lsf.InitTempMatrix().Translate(transV1);
            lsf.ApplyTempMatrix();
            lsf.DestroyTempMatrix();
        }
示例#19
0
        public static void CreateFace()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl2 = msgSplineStruct.Create();

            tmpPnt.x = -1.0; tmpPnt.y = -3.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 0);
            tmpPnt.x = -3.0; tmpPnt.y = 0.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 1);
            tmpPnt.x = -1.0; tmpPnt.y = -1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 2);
            tmpPnt.x = 0.0; tmpPnt.y = 1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 3);
            tmpPnt.x = -1.0; tmpPnt.y = 4.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 4);
            tmpPnt.x = 3.0; tmpPnt.y = 1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 5);
            tmpPnt.x = 2.0; tmpPnt.y = -3.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 6);
            tmpPnt.x = 1.0; tmpPnt.y = -1.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 7);
            tmpPnt.x = 1.0; tmpPnt.y = -4.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 8);
            spl2.Close();

            msgSpline spl2_obj = msgSpline.Create(spl2);

            msgSplineStruct.Delete(spl2);
            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            msg2DObject[] holes = new msg2DObject[3];

            msgCircleStruct cirGeo = new msgCircleStruct();
            msgPointStruct  cirC   = new msgPointStruct(0.8, 1.0, 0.0);
            msgVectorStruct cirNor = new msgVectorStruct(0.0, 0.0, 1.0);

            cirGeo.FromCenterRadiusNormal(cirC, 0.8, cirNor);
            holes[0] = msgCircle.Create(cirGeo);
            scene.AttachObject(holes[0]);
            holes[0].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            holes[0].SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            cirC.x = 1.6; cirC.y = -1.0;
            cirGeo.FromCenterRadiusNormal(cirC, 0.2, cirNor);
            holes[1] = msgCircle.Create(cirGeo);
            scene.AttachObject(holes[1]);
            holes[1].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            holes[1].SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);


            cirC.x = 0.0; cirC.y = -1.0;
            cirGeo.FromCenterRadiusNormal(cirC, 0.4, cirNor);
            holes[2] = msgCircle.Create(cirGeo);
            scene.AttachObject(holes[2]);
            holes[2].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            holes[2].SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            msg3DObject fcO = (msg3DObject)msgSurfaces.Face(spl2_obj, holes);

            scene.AttachObject(fcO);
            fcO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 50);

            msgVectorStruct transV1 = new msgVectorStruct(-5, 0, 0);

            fcO.InitTempMatrix().Translate(transV1);
            fcO.ApplyTempMatrix();
            fcO.DestroyTempMatrix();
        }
示例#20
0
        public static void CreateFromClips()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl1 = msgSplineStruct.Create();

            tmpPnt.x = 98.0; tmpPnt.y = 0.0; tmpPnt.z = -13.0;
            spl1.AddKnot(tmpPnt, 0);
            tmpPnt.x = 85.0; tmpPnt.y = 0.0; tmpPnt.z = 19.0;
            spl1.AddKnot(tmpPnt, 1);
            tmpPnt.x = 43.0; tmpPnt.y = 0.0; tmpPnt.z = -31.0;
            spl1.AddKnot(tmpPnt, 2);
            tmpPnt.x = 5.0; tmpPnt.y = 0.0; tmpPnt.z = -3.0;
            spl1.AddKnot(tmpPnt, 3);
            tmpPnt.x = -11.0; tmpPnt.y = 0.0; tmpPnt.z = -39.0;
            spl1.AddKnot(tmpPnt, 4);
            tmpPnt.x = -48.0; tmpPnt.y = 0.0; tmpPnt.z = 23.0;
            spl1.AddKnot(tmpPnt, 5);
            tmpPnt.x = -125.0; tmpPnt.y = 0.0; tmpPnt.z = 23.0;
            spl1.AddKnot(tmpPnt, 6);

            msgSpline spl1_obj = msgSpline.Create(spl1);

            msgSplineStruct.Delete(spl1);
            scene.AttachObject(spl1_obj);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgSplineStruct spl2 = msgSplineStruct.Create();

            tmpPnt.x = 96.0; tmpPnt.y = 150.0; tmpPnt.z = 8.0;
            spl2.AddKnot(tmpPnt, 0);
            tmpPnt.x = 66.0; tmpPnt.y = 150.0; tmpPnt.z = -20.0;
            spl2.AddKnot(tmpPnt, 1);
            tmpPnt.x = 12.0; tmpPnt.y = 150.0; tmpPnt.z = 37.0;
            spl2.AddKnot(tmpPnt, 2);
            tmpPnt.x = -128.0; tmpPnt.y = 150.0; tmpPnt.z = -23.0;
            spl2.AddKnot(tmpPnt, 3);

            msgSpline spl2_obj = msgSpline.Create(spl2);

            msgSplineStruct.Delete(spl2);
            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgLine ln_obj = msgLine.Create(100.0, 100.0, 50.0, -121.0, 100.0, -50.0);

            scene.AttachObject(ln_obj);
            ln_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            ln_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgArcStruct   arcG   = new msgArcStruct();
            msgPointStruct arcBeg = new msgPointStruct(98.0, 50.0, -80.0);
            msgPointStruct arcEnd = new msgPointStruct(-117.0, 50.0, -80.0);
            msgPointStruct arcMid = new msgPointStruct(-55.0, 50.0, -50.0);

            arcG.FromThreePoints(arcBeg, arcEnd, arcMid, false);
            msgArc arc_obj = msgArc.Create(arcG);

            scene.AttachObject(arc_obj);
            arc_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            arc_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msg2DObject[] objcts = new msg2DObject[4];
            objcts[0] = spl1_obj;
            objcts[1] = arc_obj;
            objcts[2] = ln_obj;
            objcts[3] = spl2_obj;

            double[] param = new double[4];
            param[0] = param[1] = param[2] = param[3] = 0.0;

            msgObject surf = msgSurfaces.SplineSurfaceFromSections(objcts, param, false);

            scene.AttachObject(surf);
            surf.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 24);

            msgVectorStruct transV1 = new msgVectorStruct(0, 0, -5);

            surf.InitTempMatrix().Translate(transV1);
            surf.ApplyTempMatrix();
            surf.DestroyTempMatrix();
        }
示例#21
0
        public static void CreateLinear()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            Utils.AddFloorInScene(30.0, 30.0, 2.0, 5.0, -2.0);

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl1 = msgSplineStruct.Create();
            int             fl   = 0;

            for (double i = 0.0; i < 2.0 * 3.14159265; i += 0.4)
            {
                tmpPnt.x = ((double)(fl % 3 + 2)) * Math.Cos(i);
                tmpPnt.y = ((double)(fl % 3 + 2)) * Math.Sin(i);
                tmpPnt.z = 0.0;
                spl1.AddKnot(tmpPnt, fl);
                fl++;
            }
            spl1.Close();

            msgSpline spl1_obj = msgSpline.Create(spl1);

            scene.AttachObject(spl1_obj);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgSplineStruct.Delete(spl1);

            msgCircleStruct cirGeo = new msgCircleStruct();

            cirGeo.center.x = 2.0; cirGeo.center.y = -2.0; cirGeo.center.z = 8.0;
            cirGeo.normal.x = 0.0; cirGeo.normal.y = 0.0; cirGeo.normal.z = 1.0;
            cirGeo.radius   = 1.5;
            msgCircle cir = msgCircle.Create(cirGeo);

            scene.AttachObject(cir);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msg3DObject linO1 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj,
                                                                                   cir, 0.5f, false);

            scene.AttachObject(linO1);
            linO1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 90);

            msgVectorStruct transV1 = new msgVectorStruct(0, 7, 0);

            linO1.InitTempMatrix().Translate(transV1);
            linO1.ApplyTempMatrix();
            linO1.DestroyTempMatrix();


            msg3DObject linO2 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj,
                                                                                   cir, 0.7f, true);

            scene.AttachObject(linO2);
            linO2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 150);

            transV1.x = 8.0; transV1.y = 0.0;
            linO2.InitTempMatrix().Translate(transV1);
            linO2.ApplyTempMatrix();
            linO2.DestroyTempMatrix();


            msg3DObject linO3 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj,
                                                                                   cir, 0.3f, false);

            scene.AttachObject(linO3);
            linO3.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 30);

            transV1.x = -8.0; transV1.y = 0.0;
            linO3.InitTempMatrix().Translate(transV1);
            linO3.ApplyTempMatrix();
            linO3.DestroyTempMatrix();
        }
示例#22
0
        public static void CreateCoonsFrom4Curves()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl1 = msgSplineStruct.Create();

            tmpPnt.x = -6.0; tmpPnt.y = 0.0; tmpPnt.z = -1.0;
            spl1.AddKnot(tmpPnt, 0);
            tmpPnt.x = -5.0; tmpPnt.y = 0.0; tmpPnt.z = 2.0;
            spl1.AddKnot(tmpPnt, 1);
            tmpPnt.x = -3.0; tmpPnt.y = 0.0; tmpPnt.z = -2.0;
            spl1.AddKnot(tmpPnt, 2);
            tmpPnt.x = -2.0; tmpPnt.y = 0.0; tmpPnt.z = -2.0;
            spl1.AddKnot(tmpPnt, 3);
            tmpPnt.x = -1.0; tmpPnt.y = 0.0; tmpPnt.z = 1.0;
            spl1.AddKnot(tmpPnt, 4);
            tmpPnt.x = 2.0; tmpPnt.y = 0.0; tmpPnt.z = 1.0;
            spl1.AddKnot(tmpPnt, 5);
            tmpPnt.x = 2.0; tmpPnt.y = 0.0; tmpPnt.z = 0.0;
            spl1.AddKnot(tmpPnt, 6);
            tmpPnt.x = 4.0; tmpPnt.y = 0.0; tmpPnt.z = 1.0;
            spl1.AddKnot(tmpPnt, 7);

            msgSpline spl1_obj = msgSpline.Create(spl1);

            msgSplineStruct.Delete(spl1);
            scene.AttachObject(spl1_obj);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            msgSplineStruct spl2 = msgSplineStruct.Create();

            tmpPnt.x = -5.0; tmpPnt.y = 4.0; tmpPnt.z = 2.0;
            spl2.AddKnot(tmpPnt, 0);
            tmpPnt.x = -3.0; tmpPnt.y = 4.0; tmpPnt.z = 1.0;
            spl2.AddKnot(tmpPnt, 1);
            tmpPnt.x = -2.0; tmpPnt.y = 4.0; tmpPnt.z = 2.0;
            spl2.AddKnot(tmpPnt, 2);
            tmpPnt.x = -1.0; tmpPnt.y = 4.0; tmpPnt.z = -1.0;
            spl2.AddKnot(tmpPnt, 3);
            tmpPnt.x = 4.0; tmpPnt.y = 4.0; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 4);

            msgSpline spl2_obj = msgSpline.Create(spl2);

            msgSplineStruct.Delete(spl2);
            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 10);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgSplineStruct spl3 = msgSplineStruct.Create();

            tmpPnt.x = -6.0; tmpPnt.y = 0.0; tmpPnt.z = -1.0;
            spl3.AddKnot(tmpPnt, 0);
            tmpPnt.x = -7.0; tmpPnt.y = 0.5; tmpPnt.z = 3.0;
            spl3.AddKnot(tmpPnt, 1);
            tmpPnt.x = -4.0; tmpPnt.y = 2.0; tmpPnt.z = -1.0;
            spl3.AddKnot(tmpPnt, 2);
            tmpPnt.x = -5.0; tmpPnt.y = 3.0; tmpPnt.z = 1.0;
            spl3.AddKnot(tmpPnt, 3);
            tmpPnt.x = -5.0; tmpPnt.y = 4.0; tmpPnt.z = 2.0;
            spl3.AddKnot(tmpPnt, 4);

            msgSpline spl3_obj = msgSpline.Create(spl3);

            msgSplineStruct.Delete(spl3);
            scene.AttachObject(spl3_obj);
            spl3_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 50);
            spl3_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 3);

            msgSplineStruct spl4 = msgSplineStruct.Create();

            tmpPnt.x = 4.0; tmpPnt.y = 0.0; tmpPnt.z = 1.0;
            spl4.AddKnot(tmpPnt, 0);
            tmpPnt.x = 3.0; tmpPnt.y = 1.0; tmpPnt.z = 2.0;
            spl4.AddKnot(tmpPnt, 1);
            tmpPnt.x = 5.0; tmpPnt.y = 2.0; tmpPnt.z = -1.0;
            spl4.AddKnot(tmpPnt, 2);
            tmpPnt.x = 3.0; tmpPnt.y = 3.0; tmpPnt.z = 0.5;
            spl4.AddKnot(tmpPnt, 3);
            tmpPnt.x = 4.0; tmpPnt.y = 4.0; tmpPnt.z = 0.0;
            spl4.AddKnot(tmpPnt, 4);

            msgSpline spl4_obj = msgSpline.Create(spl4);

            msgSplineStruct.Delete(spl4);
            scene.AttachObject(spl4_obj);
            spl4_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 100);
            spl4_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 4);

            msg3DObject coons = (msg3DObject)msgSurfaces.Coons(spl1_obj,
                                                               spl2_obj,
                                                               spl3_obj,
                                                               spl4_obj, 36, 36, 4, 4);

            scene.AttachObject(coons);
            coons.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 4);

            msgVectorStruct transV1 = new msgVectorStruct(0, 0, -0.3);

            coons.InitTempMatrix().Translate(transV1);
            coons.ApplyTempMatrix();
            coons.DestroyTempMatrix();
        }
示例#23
0
        public static void CreateCoonsFrom3Curves()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgPointStruct tmpPnt = new msgPointStruct();

            msgSplineStruct spl1 = msgSplineStruct.Create();

            tmpPnt.x = -6.0; tmpPnt.y = 0.0; tmpPnt.z = -1.0;
            spl1.AddKnot(tmpPnt, 0);
            tmpPnt.x = -5.0; tmpPnt.y = 0.0; tmpPnt.z = -2.0;
            spl1.AddKnot(tmpPnt, 1);
            tmpPnt.x = -3.0; tmpPnt.y = 0.0; tmpPnt.z = -1.0;
            spl1.AddKnot(tmpPnt, 2);
            tmpPnt.x = -2.0; tmpPnt.y = 0.0; tmpPnt.z = -2.0;
            spl1.AddKnot(tmpPnt, 3);
            tmpPnt.x = -1.0; tmpPnt.y = 0.0; tmpPnt.z = 1.0;
            spl1.AddKnot(tmpPnt, 4);
            tmpPnt.x = 2.0; tmpPnt.y = 0.0; tmpPnt.z = 1.0;
            spl1.AddKnot(tmpPnt, 5);
            tmpPnt.x = 2.0; tmpPnt.y = 0.0; tmpPnt.z = 0.0;
            spl1.AddKnot(tmpPnt, 6);
            tmpPnt.x = 4.0; tmpPnt.y = 0.0; tmpPnt.z = 1.0;
            spl1.AddKnot(tmpPnt, 7);

            msgSpline spl1_obj = msgSpline.Create(spl1);

            msgSplineStruct.Delete(spl1);
            scene.AttachObject(spl1_obj);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 0);
            spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 1);

            msgSplineStruct spl2 = msgSplineStruct.Create();

            tmpPnt.x = -6.0; tmpPnt.y = 0.0; tmpPnt.z = -1.0;
            spl2.AddKnot(tmpPnt, 0);
            tmpPnt.x = -6.0; tmpPnt.y = 0.5; tmpPnt.z = 0.0;
            spl2.AddKnot(tmpPnt, 1);
            tmpPnt.x = -6.0; tmpPnt.y = 2.0; tmpPnt.z = -1.0;
            spl2.AddKnot(tmpPnt, 2);
            tmpPnt.x = -6.0; tmpPnt.y = 3.0; tmpPnt.z = 1.0;
            spl2.AddKnot(tmpPnt, 3);
            tmpPnt.x = -4.0; tmpPnt.y = 4.0; tmpPnt.z = 1.0;
            spl2.AddKnot(tmpPnt, 4);

            msgSpline spl2_obj = msgSpline.Create(spl2);

            msgSplineStruct.Delete(spl2);
            scene.AttachObject(spl2_obj);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 50);
            spl2_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 3);

            msgPointStruct ArP1   = new msgPointStruct();
            msgPointStruct ArP2   = new msgPointStruct();
            msgPointStruct ArP3   = new msgPointStruct();
            msgArcStruct   ArcGeo = new msgArcStruct();

            ArP1.x = -4.0; ArP1.y = 4.0; ArP1.z = 1.0;
            ArP2.x = 4.0; ArP2.y = 0.0; ArP2.z = 1.0;
            ArP3.x = 0.0; ArP3.y = 5.0; ArP3.z = -4.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            msgArc arcObj = msgArc.Create(ArcGeo);

            scene.AttachObject(arcObj);
            arcObj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 20);
            arcObj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 3);

            msg3DObject coons = (msg3DObject)msgSurfaces.Coons(spl1_obj, spl2_obj, arcObj, null, 36, 36, 4, 4);

            scene.AttachObject(coons);
            coons.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 4);

            msgVectorStruct transV1 = new msgVectorStruct(0, 0, -0.4);

            coons.InitTempMatrix().Translate(transV1);
            coons.ApplyTempMatrix();
            coons.DestroyTempMatrix();
        }
示例#24
0
        public static void CreatePipeBody()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgObject[] objcts = new msgObject[5];

            msgPointStruct ArP1   = new msgPointStruct();
            msgPointStruct ArP2   = new msgPointStruct();
            msgPointStruct ArP3   = new msgPointStruct();
            msgArcStruct   ArcGeo = new msgArcStruct();

            ArP1.x = 0.0; ArP1.y = -2.0; ArP1.z = 0.0;
            ArP2.x = 1.0; ArP2.y = -1.0; ArP2.z = 0.0;
            ArP3.x = 0.4; ArP3.y = -1.2; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[0] = msgArc.Create(ArcGeo);

            ArP1.x = 1.0; ArP1.y = -1.0; ArP1.z = 0.0;
            ArP2.x = 2.0; ArP2.y = 0.0; ArP2.z = 0.0;
            ArP3.x = 1.9; ArP3.y = -0.5; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[1] = msgArc.Create(ArcGeo);

            ArP1.x = 2.0; ArP1.y = 0.0; ArP1.z = 0.0;
            ArP2.x = 1.0; ArP2.y = 1.0; ArP2.z = 0.0;
            ArP3.x = 1.6; ArP3.y = 0.8; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[2] = msgArc.Create(ArcGeo);

            objcts[3] = msgLine.Create(1.0, 1.0, 0.0, -1.0, 1.0, 0.0);

            ArP1.x = -1.0; ArP1.y = 1.0; ArP1.z = 0.0;
            ArP2.x = -1.0; ArP2.y = 0.0; ArP2.z = 1.0;
            ArP3.x = -1.1; ArP3.y = 1.0; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[4] = msgArc.Create(ArcGeo);

            msgContour cnt1 = msgContour.CreateContour(objcts);

            scene.AttachObject(cnt1);
            cnt1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cnt1.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            ArP1.x = -0.2; ArP1.y = -0.2; ArP1.z = 0.0;
            ArP2.x = -0.1; ArP2.y = 0.2; ArP2.z = 0.0;
            ArP3.x = -0.3; ArP3.y = 0.1; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[0] = msgArc.Create(ArcGeo);


            ArP1.x = -0.1; ArP1.y = 0.2; ArP1.z = 0.0;
            ArP2.x = 0.3; ArP2.y = 0.5; ArP2.z = 0.0;
            ArP3.x = 0.2; ArP3.y = 0.6; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[1] = msgArc.Create(ArcGeo);

            ArP1.x = 0.3; ArP1.y = 0.5; ArP1.z = 0.0;
            ArP2.x = -0.2; ArP2.y = -0.2; ArP2.z = 0.0;
            ArP3.x = 0.6; ArP3.y = -0.4; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[2] = msgArc.Create(ArcGeo);

            msgObject[] objcts2 = null;
            Array.Copy(objcts, objcts2, 3);
            msgContour cnt2 = msgContour.CreateContour(objcts2);

            scene.AttachObject(cnt2);
            cnt2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cnt2.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgCircleStruct cirGeo = new msgCircleStruct();
            msgPointStruct  cirC   = new msgPointStruct(0.3, -0.1, 0.0);
            msgVectorStruct cirNor = new msgVectorStruct(0.0, 0.0, 1.0);

            cirGeo.FromCenterRadiusNormal(cirC, 0.31, cirNor);
            msg2DObject cir = msgCircle.Create(cirGeo);

            scene.AttachObject(cir);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cir.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgPointStruct point_in_plane = new msgPointStruct(0.0, 0.0, 0.0);

            bool        close = true;
            msg3DObject pipO  = (msg3DObject)msgKinematic.Pipe(cnt2, new msg2DObject[] { cir }, cnt1, point_in_plane, 0.0, ref close);

            scene.AttachObject(pipO);
            pipO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 25);

            msgVectorStruct transV1 = new msgVectorStruct(3.0, 1.0, 0);

            pipO.InitTempMatrix().Translate(transV1);
            pipO.ApplyTempMatrix();
            pipO.DestroyTempMatrix();
        }
示例#25
0
        public static void CreatePipeSurface()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgArcStruct   ArcGeo = new msgArcStruct();
            msgPointStruct ArP1   = new msgPointStruct(1.0, -4.0, 0.0);
            msgPointStruct ArP2   = new msgPointStruct(1.0, -3.6, 0.0);
            msgPointStruct ArP3   = new msgPointStruct(1.2, -3.5, 0.0);

            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            msg2DObject ar = msgArc.Create(ArcGeo);

            scene.AttachObject(ar);
            ar.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            ar.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgObject[] objcts = new msgObject[6];

            objcts[0] = msgLine.Create(0.0, -4.0, 0.0, 0.0, -2.0, 0.0);

            ArP1.x = 0.0; ArP1.y = -2.0; ArP1.z = 0.0;
            ArP2.x = 1.0; ArP2.y = -1.0; ArP2.z = 0.0;
            ArP3.x = 0.4; ArP3.y = -1.2; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[1] = msgArc.Create(ArcGeo);

            ArP1.x = 1.0; ArP1.y = -1.0; ArP1.z = 0.0;
            ArP2.x = 2.0; ArP2.y = 0.0; ArP2.z = 0.0;
            ArP3.x = 1.9; ArP3.y = -0.5; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[2] = msgArc.Create(ArcGeo);

            ArP1.x = 2.0; ArP1.y = 0.0; ArP1.z = 0.0;
            ArP2.x = 1.0; ArP2.y = 1.0; ArP2.z = 0.0;
            ArP3.x = 1.6; ArP3.y = 0.8; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[3] = msgArc.Create(ArcGeo);

            objcts[4] = msgLine.Create(1.0, 1.0, 0.0, -1.0, 1.0, 0.0);

            ArP1.x = -1.0; ArP1.y = 1.0; ArP1.z = 0.0;
            ArP2.x = -1.0; ArP2.y = 0.0; ArP2.z = 1.0;
            ArP3.x = -1.1; ArP3.y = 1.0; ArP3.z = 0.0;
            ArcGeo.FromThreePoints(ArP1, ArP2, ArP3, false);
            objcts[5] = msgArc.Create(ArcGeo);

            msgContour cnt1 = msgContour.CreateContour(objcts);

            scene.AttachObject(cnt1);
            cnt1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12);
            cnt1.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2);

            msgPointStruct point_in_plane = new msgPointStruct(1.0, -4.0, 0.0);

            bool        close = false;
            msg3DObject pipO  = (msg3DObject)msgKinematic.Pipe(ar, null, cnt1, point_in_plane, 0.0, ref close);

            scene.AttachObject(pipO);
            pipO.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 25);

            msgVectorStruct transV1 = new msgVectorStruct(2.5, 1, 0);

            pipO.InitTempMatrix().Translate(transV1);
            pipO.ApplyTempMatrix();
            pipO.DestroyTempMatrix();
        }
示例#26
0
        public static void CreateIntersection()
        {
            msgScene scene = msgScene.GetScene();

            scene.Clear();

            msgTorus        tor1    = msgTorus.Create(2, 1, 24, 24);
            msgTorus        tor2    = msgTorus.Create(2, 0.3, 24, 24);
            msgVectorStruct transV1 = new msgVectorStruct(1, 1, 0);

            tor2.InitTempMatrix().Translate(transV1);
            tor2.ApplyTempMatrix();
            tor2.DestroyTempMatrix();
            scene.AttachObject(tor1);
            tor1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 5);
            scene.AttachObject(tor2);
            tor2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 45);

            msgVectorStruct transV2 = new msgVectorStruct(0, 0, 1.5);

            msgGroup bool1 = msgBoolean.Intersection(tor1, tor2);

            int ChCnt = bool1.GetChildrenList().GetCount();

            msgObject[] allChilds = null;
            bool1.BreakGroup(ref allChilds);

            msgObject.DeleteObject(bool1);
            for (ushort i = 0; i < ChCnt; i++)
            {
                allChilds[i].InitTempMatrix().Translate(transV2);
                allChilds[i].ApplyTempMatrix();
                allChilds[i].DestroyTempMatrix();
                scene.AttachObject(allChilds[i]);
                allChilds[i].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, (ushort)(10 + i));
            }

            msgBox          bx1     = msgBox.Create(2, 2, 1);
            msgSphere       sp1     = msgSphere.Create(1, 24, 24);
            msgVectorStruct transV4 = new msgVectorStruct(3, 3, 0);

            bx1.InitTempMatrix().Translate(transV4);
            bx1.ApplyTempMatrix();
            bx1.DestroyTempMatrix();
            scene.AttachObject(bx1);
            bx1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 55);
            msgVectorStruct transV5 = new msgVectorStruct(3, 4, 0);

            sp1.InitTempMatrix().Translate(transV5);
            sp1.ApplyTempMatrix();
            sp1.DestroyTempMatrix();
            scene.AttachObject(sp1);
            sp1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 75);

            msgGroup bool2 = msgBoolean.Intersection(sp1, bx1);

            ChCnt = bool2.GetChildrenList().GetCount();
            bool2.BreakGroup(ref allChilds);

            msgObject.DeleteObject(bool2);
            for (ushort i = 0; i < ChCnt; i++)
            {
                allChilds[i].InitTempMatrix().Translate(transV2);
                allChilds[i].ApplyTempMatrix();
                allChilds[i].DestroyTempMatrix();
                scene.AttachObject(allChilds[i]);
                allChilds[i].SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, (ushort)(10 + i));
            }
        }