Ejemplo n.º 1
0
        //Draws the vector of the coordinate system
        private static void DrawVector(T3D.Point StartPoint, T3D.Vector Vector, string Text)
        {
            Color        Color   = new Color(0, 1, 1);
            const double Radians = 0.43;

            Vector = Vector.GetNormal();
            T3D.Vector Arrow01 = new T3D.Vector(Vector);

            Vector.Normalize(500);
            T3D.Point EndPoint = new T3D.Point(StartPoint);
            EndPoint.Translate(Vector.X, Vector.Y, Vector.Z);
            GraphicsDrawer.DrawLineSegment(StartPoint, EndPoint, Color);

            GraphicsDrawer.DrawText(EndPoint, Text, Color);

            Arrow01.Normalize(-100);
            T3D.Vector Arrow = ArrowVector(Arrow01, Radians);

            T3D.Point ArrowExtreme = new T3D.Point(EndPoint);
            ArrowExtreme.Translate(Arrow.X, Arrow.Y, Arrow.Z);
            GraphicsDrawer.DrawLineSegment(EndPoint, ArrowExtreme, Color);

            Arrow = ArrowVector(Arrow01, -Radians);

            ArrowExtreme = new T3D.Point(EndPoint);
            ArrowExtreme.Translate(Arrow.X, Arrow.Y, Arrow.Z);
            GraphicsDrawer.DrawLineSegment(EndPoint, ArrowExtreme, Color);
        }
Ejemplo n.º 2
0
        private static void DrawMesh(Plane plane)
        {
            GraphicsDrawer graphicsDrawer = new GraphicsDrawer();

            Mesh  mesh   = new Mesh();
            Point Point1 = new Point(plane.Origin);

            Vector NormalX = plane.AxisX.GetNormal() * 300;

            Point Point2 = new Point(plane.Origin);

            Point2.Translate(NormalX.X, NormalX.Y, NormalX.Z);

            Vector NormalY = plane.AxisY.GetNormal() * 300;

            Point Point3 = new Point(plane.Origin);

            Point3.Translate(NormalY.X, NormalY.Y, NormalY.Z);

            Point Point4 = new Point(Point2);

            Point4.Translate(NormalY.X, NormalY.Y, NormalY.Z);

            mesh.AddPoint(Point1);
            mesh.AddPoint(Point2);
            mesh.AddPoint(Point3);
            mesh.AddPoint(Point4);

            mesh.AddTriangle(0, 1, 2);
            mesh.AddTriangle(2, 1, 0);
            mesh.AddTriangle(1, 2, 3);
            mesh.AddTriangle(3, 2, 1);

            graphicsDrawer.DrawMeshSurface(mesh, new Color(1, 0, 0));
        }