helix-toolkit icon indicating copy to clipboard operation
helix-toolkit copied to clipboard

UpdateBounds for small line/point geometrys wrong.

Open gregorsGit opened this issue 9 months ago • 4 comments

Hi, I use small line geometrys and the calculated bounds are to huge. The Length Squared() was < 0.01 .. I found this code in Line Geometry 3D.cs..

public override void UpdateBounds() { base.UpdateBounds(); //if (Bound.Size.LengthSquared() < 1e-1f) //{ // var off = new Vector3(0.5f); // Bound = new BoundingBox(Bound.Minimum - off, Bound.Maximum + off); //} if (BoundingSphere.Radius < 1e-1f) { BoundingSphere = new BoundingSphere(BoundingSphere.Center, 0.5f); } } When i remove the check everything is working for me. The bounds, zoom-extends, ... is working.

What is the reseon for this size check?? To reproduce this, take workitem example 51 .. And use only one LineGeometry3D with this resources.xaml.. <dx:LineGeometry3D x:Key="Lines" Indices="0 1 1 2 2 3 3 0 4 5 5 6 6 7 7 4 0 4 1 5 2 6 3 7" Positions="-0.05,-0.025,-0.1 0.05,-0.025,-0.1 0.05,0.025,-0.1 -0.05,0.025,-0.1 -0.05,-0.025,0.1 0.05,-0.025,0.1 0.05,0.025,0.1 -0.05,0.025,0.1" />

Then use zoom extend.. And auto zoom is not working...

gregorsGit avatar Jun 25 '25 06:06 gregorsGit

Probably I added it to avoid some floating point errors on hit testing on small bounding box. I can relax the minimum bound size.

holance avatar Jun 27 '25 05:06 holance

Can you make the epsilon value public? So i can change this value for my use case.

gregorsGit avatar Jun 27 '25 06:06 gregorsGit

I think you can try to do a scaling transform on top of your scene tree.

holance avatar Jun 27 '25 06:06 holance

I cannot scale the top of this scene in my case.

gregorsGit avatar Jun 27 '25 07:06 gregorsGit