Anchor arrow as EndLineCap of an LineArcVisual3D doesn't work
#1
When I try to put an Arrow Anchor as EndLineCap for a LineArcVisual3D, doesn't show the arrow.
In this example doesn't work any other type of arrow anchor.  
Ab3d.Visuals.LineArcVisual3D supportArc = new LineArcVisual3D();
                            supportArc.CircleCenterPosition = new Point3D(0,0,0);
                            supportArc.CircleNormal = new System.Windows.Media.Media3D.Vector3D(0, 1, 1);
                            supportArc.Radius = 2.5;
                            supportArc.ZeroAngleDirection = new System.Windows.Media.Media3D.Vector3D(1, 0, 0);
                            supportArc.StartAngle = 300;
                            supportArc.EndAngle = 30;
                            supportArc.EndLineCap = Ab3d.Common.Models.LineCap.ArrowAnchor;
                            supportArc.LineThickness = 2;
                            supportArc.LineColor = supportsColor;
#2
By default the maximum length of the arrow can be 1/3 of the line length (on the screen). This is controller by the static LineMaterial.MaxLineArrowLength property. But this value cannot be bigger than 1 (in this case 1 is used).

This works well for individual 3D lines. In case you move the camera so that it looks in the same direction as the line, then as the line length on the screen is reducing, also the length of the arrow is reducing.

But this does not work well for polylines or other connected lines where the individual line segments are very short. In this case this reduces the line arrow length to almost zero (1/3 of the line segment length), though the total length all all line segments is much bigger.

To solve that, I have updated the Ab3d.DXEngine so that by default the length of the arrow for polylines or other connected lines is at least 2 times the line thickness (this is controlled by a new static LineMaterial.MinLineStripArrowLength property). This can still reduce the length of line arrow but this the arrow is still big enough to be easily visible. Also reducing the size of the arrow solves the problem were the arrow could look disconnected from the line, for example:
   

See the updated Line caps sample that now demonstrates this:
   

You can also increase the min size of the arrows by increasing the value of MinLineStripArrowLength. See example for 4:
   


This improvement will be available in the next version of the Ab3d.DXEngine.
I will send you a link by email to get a pre-release version.
Andrej Benedik
#3
Thank you. Can it be solved even in power.toys version?
#4
I would not recommend rendering a lot of 3D lines without Ab3d.DXEngine because this can be very slow.

In Ab3d.PowerToys it is possible to increase the size of arrows on LineArcVisual3D by increasing the static LinesUpdater.Instance.MaxLineArrowLength (for example from 0.333 to 1) and LinesUpdater.Instance.LineArrowAngle (for example from 15 to 30). 

There the code that generates the line arc can check the length of a last few segments and considers this as the line length when deciding how big the line arrow is. The code is the following:

Code:
// Set maximum length of arrow
double shownAngle = Math.Abs(endAngle - startAngle);

if (shownAngle < 1)
    shownAngle = 1;

double oneSegmentAngle = shownAngle / (double)segments;

lineSegmentsCountForArrowLength = (int)(LinesUpdater.Instance.LineArrowAngle / oneSegmentAngle);

if (lineSegmentsCountForArrowLength > segments - 3)
    lineSegmentsCountForArrowLength = segments - 3;

if (lineSegmentsCountForArrowLength <= 0)
    lineSegmentsCountForArrowLength = 1;
Andrej Benedik
  


Forum Jump:


Users browsing this thread:
1 Guest(s)