HelixToolkit.Wpf.MeshBuilder.AddArrow C# (CSharp) Method

AddArrow() public method

Adds an arrow to the mesh.
public AddArrow ( System.Windows.Media.Media3D.Point3D point1, System.Windows.Media.Media3D.Point3D point2, double diameter, double headLength = 3, double headDiameter = 2, int thetaDiv = 18 ) : void
point1 System.Windows.Media.Media3D.Point3D /// The start point. ///
point2 System.Windows.Media.Media3D.Point3D /// The end point. ///
diameter double /// The diameter of the arrow cylinder. ///
headLength double /// Length of the head (relative to diameter). ///
headDiameter double
thetaDiv int /// The number of divisions around the arrow. ///
return void
        public void AddArrow(Point3D point1, Point3D point2, double diameter, double headLength = 3, double headDiameter = 2, int thetaDiv = 18)
        {
            var dir = point2 - point1;
            double length = dir.Length;
            double r = diameter / 2;

            var pc = new PointCollection
                {
                    new Point(0, 0),
                    new Point(0, r),
                    new Point(length - (diameter * headLength), r),
                    new Point(length - (diameter * headLength), r * headDiameter),
                    new Point(length, 0)
                };

            this.AddRevolvedGeometry(pc, point1, dir, thetaDiv);
        }

Usage Example

示例#1
0
        //// Using a DependencyProperty as the backing store for Direction.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty DirectionProperty =
        //    DependencyProperty.Register("Direction", typeof(Vector3D), typeof(SensorVisual3D), new PropertyMetadata(new Vector3D(1, 0, 0), GeometryChanged));

        //public string Name
        //{
        //    get { return (string)GetValue(NameProperty); }
        //    set { SetValue(NameProperty, value); }
        //}

        //// Using a DependencyProperty as the backing store for Name.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty NameProperty =
        //    DependencyProperty.Register("Name", typeof(Size3D), typeof(SensorVisual3D), new PropertyMetadata(new Size3D(), GeometryChanged));

        //public Size3D Size
        //{
        //    get { return (Size3D)GetValue(SizeProperty); }
        //    set { SetValue(SizeProperty, value); }
        //}

        //// Using a DependencyProperty as the backing store for Size.  This enables animation, styling, binding, etc...
        //public static readonly DependencyProperty SizeProperty =
        //    DependencyProperty.Register("Size", typeof(Size3D), typeof(SensorVisual3D), new PropertyMetadata(new Size3D(0, 0, 0), GeometryChanged));

        /// <summary>
        /// The tessellate.
        /// </summary>
        /// <returns>The mesh.</returns>
        protected override MeshGeometry3D Tessellate()
        {
            var builder = new ht.MeshBuilder(true, true);

            builder.AddArrow(this.Position, this.Position + this.Orientation.Axis, 1);

            return(builder.ToMesh());
        }
All Usage Examples Of HelixToolkit.Wpf.MeshBuilder::AddArrow