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

Non-normalized AlignedAxis Is Ignored #6596

Open
esparano opened this issue May 17, 2018 · 4 comments
Open

Non-normalized AlignedAxis Is Ignored #6596

esparano opened this issue May 17, 2018 · 4 comments
Labels
good first issue An opportunity for first time contributors type - enhancement

Comments

@esparano
Copy link

esparano commented May 17, 2018

The Billboard documentation states that "The aligned axis is the unit vector that the billboard up vector points towards. The default is the zero vector, which means the billboard is aligned to the screen up vector." This indicates that the aligned axis should be a unit vector.

However, if you give the Billboard a non-normalized "unit" vector, that vector is completely ignored and the default is used instead. I think that either:
A) The documentation should clearly state that any non-normalized alignedAxis will be ignored and replaced with the Zero vector.
or better yet,
B) The alignedAxis should not have to be normalized in the first place. The Cesium code can normalize the axis internally if it needs to.

@shunter
Copy link
Contributor

shunter commented May 17, 2018

This sounded familiar so I searched through old issues to refresh my memory and summarize previous work on this topic.

In #4046 I clarified the documentation to specify that aligned axis must always be a unit vector, while adding the ability to use the velocity vector as an aligned axis.
In #5807 the CZML loading code makes sure to always normalize unit cartesian values on load. This was to avoid issues arising from imperfect floating point rounding errors when values are serialized to JSON (i.e. magnitude ends up being slightly above or below 1 at machine precision)

@esparano
Copy link
Author

Yeah I was having a similar issue where the magnitude wasn't exactly 1, so it "silently failed" and made the billboards align with the camera instead of just normalizing the vector for me or giving a warning or something. I hope one of my two suggestions could help fix that type of silent failing.

@hpinkos
Copy link
Contributor

hpinkos commented May 21, 2018

Yeah, I think this should throw a DeveloperError instead of silently failing

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.entities.add({
    position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
    billboard :{
        image : '../images/Cesium_Logo_overlay.png',
        alignedAxis: new Cesium.Cartesian3(0.0, 0.0, 2.0)
    }
});

@hpinkos hpinkos added type - enhancement good first issue An opportunity for first time contributors labels May 21, 2018
@mramato
Copy link
Contributor

mramato commented May 21, 2018

It might be time to start considering auto-normalizing vectors in certain places. The main reason we don't do it is for performance reasons, but I feel like it bites us and our users fairly often.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An opportunity for first time contributors type - enhancement
Projects
None yet
Development

No branches or pull requests

4 participants