Example #1
0
        public override void Draw(IDrawingContext ctx)
        {
            if (!Visible)
            {
                return;
            }
            if (ShowLocation)
            {
                DrawHelpers.DrawCross(Location, DrawSize);
            }
            if (ShowAux)
            {
                DrawHelpers.DrawCross(AuxPoint, DrawSize);
            }

            GL.Color3(Color.Blue);
            if (Selected)
            {
                GL.Color3(Color.Red);
            }
            GL.Begin(PrimitiveType.Lines);
            var pnts = GetPointsD();

            for (int i = 1; i < pnts.Length; i++)
            {
                var pp0 = pnts[i - 1];
                var pp1 = pnts[i];
                GL.Vertex3(pp0);
                GL.Vertex3(pp1);
            }
            GL.End();
        }
Example #2
0
        public override void Draw(IDrawingContext gr)
        {
            if (!Visible)
            {
                return;
            }
            if (DrawPoles)
            {
                foreach (var item in Poles)
                {
                    DrawHelpers.DrawCross(item, DrawSize);
                }
            }
            var p = GetPoints();

            GL.Begin(PrimitiveType.LineStrip);
            foreach (var item in p)
            {
                GL.Vertex3(item);
            }
            GL.End();
        }
Example #3
0
        public override void Draw(IDrawingContext ctx)
        {
            if (!Visible)
            {
                return;
            }
            GL.Color3(Color.Blue);
            if (Selected)
            {
                GL.Color3(Color.Red);
            }
            GL.Begin(PrimitiveType.Lines);
            GL.Vertex3(Start);
            GL.Vertex3(End);
            GL.End();

            if (ShowCrosses)
            {
                DrawHelpers.DrawCross(Start, DrawSize);
                DrawHelpers.DrawCross(End, DrawSize);
            }
        }
Example #4
0
        public override void Draw(IDrawingContext ctx)
        {
            if (!Visible)
            {
                return;
            }
            GL.Color3(Color.Blue);

            GL.Begin(PrimitiveType.LineStrip);
            var res = GetPoints();

            foreach (var item in res)
            {
                GL.Color3(Color.Blue);
                GL.Vertex3(item);
            }

            GL.End();

            if (ShowIntermediateCrosses)
            {
                GL.Color3(Color.Yellow);
                foreach (var item in res)
                {
                    DrawHelpers.DrawCross(item.ToVector3d(), DrawSize / 2);
                }
            }
            GL.Color3(Color.Blue);

            GL.Begin(PrimitiveType.Lines);
            GL.Vertex3(Center);
            GL.Vertex3(Center + Axis * 5);
            GL.End();

            DrawHelpers.DrawCross(Start, DrawSize);
            DrawHelpers.DrawCross(End, DrawSize);
            DrawHelpers.DrawCross(Center, DrawSize);
            DrawHelpers.DrawCross(Value, DrawSize);
        }
Example #5
0
        public override void Draw(IDrawingContext ctx)
        {
            if (!Visible)
            {
                return;
            }
            var cface     = GL.GetBoolean(GetPName.CullFace);
            var cfaceMode = GL.GetInteger(GetPName.CullFaceMode);

            if (FaceCulling)
            {
                GL.Enable(EnableCap.CullFace);
                GL.CullFace(CullFaceMode.Front);
            }
            tring1.Color = Color;
            tring2.Color = Color;

            tring1.V0 = edge.Start;
            tring1.V1 = edge.End;
            tring1.V2 = AuxPoint0;
            tring1.Draw(ctx);

            tring2.V0 = edge.Start;
            tring2.V1 = edge.End;
            tring2.V2 = AuxPoint1;
            tring2.Draw(ctx);

            lineHelper.Start       = edge.Start;
            lineHelper.End         = edge.End;
            lineHelper.ShowCrosses = ShowCrosses;
            lineHelper.Draw(ctx);

            var cnt  = tring1.Center();
            var cnt2 = tring2.Center();

            Normal0 = tring1.GetPlane().Normal;

            normalHelper1.DrawSize = DrawSize;
            normalHelper2.DrawSize = DrawSize;
            normalHelper1.Start    = cnt;
            normalHelper1.End      = cnt + Normal0;
            normalHelper2.Start    = cnt2;
            normalHelper2.End      = cnt2 + normal1;
            if (ShowNormals)
            {
                normalHelper2.Draw(ctx);
                normalHelper1.Draw(ctx);
            }
            if (ShowCrosses)
            {
                DrawHelpers.DrawCross(AuxPoint0, DrawSize);
                DrawHelpers.DrawCross(AuxPoint1, DrawSize);
            }

            if (FaceCulling)
            {
                if (!cface)
                {
                    GL.Disable(EnableCap.CullFace);
                }
                GL.CullFace((CullFaceMode)cfaceMode);
            }
        }
Example #6
0
        public override void Draw(IDrawingContext gr)
        {
            if (!Visible)
            {
                return;
            }
            GL.Color3(Color.Blue);
            if (Selected)
            {
                GL.Color3(Color.Red);
            }
            if (ShowGismos)
            {
                DrawHelpers.DrawCross(Location, DrawSize);
                PlaneSurface ps = new PlaneSurface()
                {
                    Position = Location, Normal = Axis
                };
                var             bs   = ps.GetBasis();
                var             dir  = bs[0] * Radius;
                List <Vector3d> pnts = new List <Vector3d>();
                var             step = Math.PI * AngleStep / 180f;
                for (double i = 0; i <= Math.PI * 2; i += step)
                {
                    var mtr4 = Matrix4d.CreateFromAxisAngle(Axis, i);
                    var res  = Vector4d.Transform(new Vector4d(dir), mtr4);
                    pnts.Add(Location + res.Xyz);
                }

                GL.Begin(PrimitiveType.LineStrip);
                for (int i = 0; i < pnts.Count; i++)
                {
                    GL.Vertex3(pnts[i]);
                }
                GL.End();
                pnts.Clear();

                for (double i = 0; i <= Math.PI * 2; i += step)
                {
                    var mtr4 = Matrix4d.CreateFromAxisAngle(Axis, i);
                    var res  = Vector4d.Transform(new Vector4d(dir), mtr4);
                    pnts.Add(Location + res.Xyz + Axis * Lenght);
                }

                GL.Begin(PrimitiveType.LineStrip);
                for (int i = 0; i < pnts.Count; i++)
                {
                    GL.Vertex3(pnts[i]);
                }
                GL.End();

                GL.Begin(PrimitiveType.Lines);
                GL.Vertex3(Location);
                GL.Vertex3(Location + Axis * Lenght);
                GL.End();
            }
            if (ShowMesh)
            {
                drawMesh();
            }
            drawContours();
        }