コード例 #1
0
        private void DrawRodGDI(DrawMaruObejctList db, double d, double t)
        {
            db.dataList.Clear();


            Point3D pt1 = new Point3D(0, 0, 0);


            //실린더
            Point3D cenPt1 = new Point3D(0f, 20f, 0f);
            Point3D cenPt2 = new Point3D(0f, (float)(-1 * 20), 0f);


            //if (t * 5 < d)
            //    t = 0.2 * d;

            float    rad = (float)(20 * (t / 2) / d);
            Cylinder cy  = new Cylinder(cenPt1, cenPt2, rad, rad, Color.Blue, 1.0f);

            db.dataList.Add(cy);

            Line indLine1 = new Line(cenPt1.OffsetX(rad * 1.1), cenPt1.OffsetX(rad * 1.1 + 16), Color.Black, 1.0f);

            db.dataList.Add(indLine1);
            Line indLine2 = new Line(cenPt2.OffsetX(rad * 1.1), cenPt2.OffsetX(rad * 1.1 + 16), Color.Black, 1.0f);

            db.dataList.Add(indLine2);
            Line indLine3 = new Line((cenPt1.OffsetX(rad * 1.1) + cenPt1.OffsetX(rad * 1.1 + 16)) / 2, (cenPt2.OffsetX(rad * 1.1) + cenPt2.OffsetX(rad * 1.1 + 16)) / 2, Color.Black, 1.0f);

            db.dataList.Add(indLine3);

            Point3D textPt = ((cenPt1 + cenPt2) / 2.0).Offset(rad * 1.1 + 8, 4, 0);

            MaruData.GLS.Text pt = new MaruData.GLS.Text(textPt, Color.Black, 5.0f);
            pt.text     = "D";
            pt.textSize = 15;
            db.dataList.Add(pt);


            //plane
            Triangle tr1 = new Triangle(pt1, pt1.OffsetX(50), pt1.Offset(50, 0, 50), Color.FromArgb(100, Color.SaddleBrown), 0.1f);

            tr1.PolyMode = PLMode.Fill;
            //  db.dataList.Add(tr1);

            Triangle tr2 = new Triangle(pt1, pt1.Offset(50, 0, 50), pt1.OffsetZ(50), Color.FromArgb(100, Color.SaddleBrown), 0.1f);

            tr2.PolyMode = PLMode.Fill;
            // db.dataList.Add(tr2);
        }
コード例 #2
0
        private void DrawTtypeGDI(DrawMaruObejctList db, double d1, double d2, double t)
        {
            db.dataList.Clear();


            Point3D pt1 = new Point3D(0, 0, 0);

            //L + t >>  50
            double depthTotal = d1 + d2;
            double scale      = 50 / depthTotal;

            //실린더
            Point3D cenPt1 = new Point3D(0f, 25, 0f);
            Point3D cenPt2 = cenPt1.OffsetY(-d1 * scale);


            float    rad = (float)(scale * (t / 3));
            Cylinder cy  = new Cylinder(cenPt1, cenPt2, rad, rad, Color.Blue, 1.0f);

            db.dataList.Add(cy);


            Line indLine1 = new Line(cenPt1.OffsetX(rad * 1.1), cenPt1.OffsetX(rad * 1.1 + 16), Color.Black, 1.0f);

            db.dataList.Add(indLine1);
            Line indLine2 = new Line(cenPt2.OffsetX(rad * 1.1), cenPt2.OffsetX(rad * 1.1 + 16), Color.Black, 1.0f);

            db.dataList.Add(indLine2);
            Line indLine3 = new Line((cenPt1.OffsetX(rad * 1.1) + cenPt1.OffsetX(rad * 1.1 + 16)) / 2, (cenPt2.OffsetX(rad * 1.1) + cenPt2.OffsetX(rad * 1.1 + 16)) / 2, Color.Black, 1.0f);

            db.dataList.Add(indLine3);

            Point3D textPt = ((cenPt1 + cenPt2) / 2.0).Offset(rad * 1.1 + 8, 10, 0);

            MaruData.GLS.Text pt = new MaruData.GLS.Text(textPt, Color.Black, 5.0f);
            pt.text     = "L";
            pt.textSize = 15;
            db.dataList.Add(pt);



            Point3D   boxBeg = new Point3D(scale * (-t / 2), -25, scale * (-t / 2));
            RectBox3D box    = new RectBox3D(boxBeg, boxBeg.Offset(scale * t, scale * d2, scale * t), Color.Blue, 1.0f);

            db.dataList.Add(box);

            Point3D tLineBasePt = boxBeg.OffsetX(1.1 * scale * t);
            Line    indLine4    = new Line(tLineBasePt, tLineBasePt.OffsetX(6), Color.Black, 1.0f);

            db.dataList.Add(indLine4);
            Line indLine5 = new Line(tLineBasePt.OffsetY(scale * d2), tLineBasePt.Offset(6, scale * d2, 0), Color.Black, 1.0f);

            db.dataList.Add(indLine5);
            Line indLine6 = new Line((tLineBasePt + tLineBasePt.OffsetX(6)) / 2, (tLineBasePt.OffsetY(scale * d2) + tLineBasePt.Offset(6, scale * d2, 0)) / 2, Color.Black, 1.0f);

            db.dataList.Add(indLine6);


            Point3D textPt2 = boxBeg.Offset(1.1 * scale * t + 4, scale * d2 / 2.0 + 4, 0);

            MaruData.GLS.Text pt2 = new MaruData.GLS.Text(textPt2, Color.Black, 5.0f);
            pt2.text     = "t";
            pt2.textSize = 15;
            db.dataList.Add(pt2);


            Point3D bLineBasePt = boxBeg.Offset(0, 0, scale * t);
            Line    indLine7    = new Line(bLineBasePt, bLineBasePt.OffsetZ(6), Color.Black, 1.0f);

            db.dataList.Add(indLine7);

            Line indLine8 = new Line(bLineBasePt.OffsetX(scale * t), bLineBasePt.Offset(scale * t, 0, 6), Color.Black, 1.0f);

            db.dataList.Add(indLine8);

            Line indLine9 = new Line((bLineBasePt + bLineBasePt.OffsetZ(6)) / 2, (bLineBasePt.OffsetX(scale * t) + bLineBasePt.Offset(scale * t, 0, 6)) / 2, Color.Black, 1.0f);

            db.dataList.Add(indLine9);


            Point3D textPt3 = boxBeg.Offset(scale * t / 2.0, scale * d2 / 2.0 + 4, 1.2 * scale * t);

            MaruData.GLS.Text pt3 = new MaruData.GLS.Text(textPt3, Color.Black, 5.0f);
            pt3.text     = "B";
            pt3.textSize = 15;
            db.dataList.Add(pt3);
        }