Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TubeSpatialObject bounding box includes rounded ends even after they are turned off #4657

Open
auneri opened this issue May 12, 2024 · 5 comments
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Comments

@auneri
Copy link

auneri commented May 12, 2024

Description

The bounding box for TubeSpatialObject always includes rounded ends.

Steps to Reproduce

tso = itk.TubeSpatialObject.x3.New()
tso.SetEndRounded(False)
for z in (-1, 1):
    tsop = itk.TubeSpatialObjectPoint.x3()
    tsop.SetPositionInObjectSpace((0, 0, z))
    tsop.SetRadiusInObjectSpace(1)
    tso.AddPoint(tsop)
tso.Update()
bbox = tso.GetMyBoundingBoxInWorldSpace()
print(bbox.GetMinimum(), bbox.GetMaximum())

Expected behavior

itkPointD3 ([-1, -1, -1]) itkPointD3 ([1, 1, 1])

Actual behavior

itkPointD3 ([-1, -1, -2]) itkPointD3 ([1, 1, 2])

The results do not change when EndRounded is toggled, though they should. Moreover, the bounding box extent in z increases when RadiusInObjectSpace is increased, which should only be expected when EndRounded is True.

Reproducibility

Happens every time.

Versions

Tested on v5.3 and v5.4rc4.

Environment

Additional Information

@auneri auneri added the type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances label May 12, 2024
Copy link

Thank you for contributing an issue! 🙏

Welcome to the ITK community! 🤗👋☀️

We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. 📜
Also, please check existing open issues and consider discussion on the ITK Discourse. 📖

This is an automatic message. Allow for time for the ITK community to be able to read the issue and comment on it.

@dzenanz
Copy link
Member

dzenanz commented May 13, 2024

@aylward can you tackle this one?

@aylward
Copy link
Member

aylward commented May 13, 2024

It would be very hard (computationally expensive and quirky) to handle all points "near" an end-point as "special." Probably should just document that EndRounded() is always considered True when computing isInside(). More accurately, should remove the "EndRounded()" flag - it is an application/rendering specific option - but that would break backward compatibility.

@auneri
Copy link
Author

auneri commented May 13, 2024

Thank you for the prompt responses! I want to note that I am using TubeSpatialObject to describe a simple cylinder. I believe there used to be a CylinderSpatialObject, but was later removed. Considering the backward compatibility, I wonder if it would be easier to reintroduce one (without all the added options for "rounded ends" or "root")? One could even consider this as a base class for TubeSpatialObject.

@aylward
Copy link
Member

aylward commented May 13, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances
Projects
None yet
Development

No branches or pull requests

3 participants