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

Fix for possible normalization issue for line corner points #12255

Merged
merged 6 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

- Fix flickering issue caused by bounding sphere retrieval being blocked by the bounding sphere of another entity. [#12230](https://github.com/CesiumGS/cesium/pull/12230)

- Fix error with normalization of corner points for lines and corridors with collinear points. [#12255](https://github.com/CesiumGS/cesium/pull/12255)

### 1.122 - 2024-10-01

#### @cesium/engine
Expand Down
8 changes: 4 additions & 4 deletions packages/engine/Source/Core/CorridorGeometryLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ CorridorGeometryLibrary.computePositions = function (params) {
Cartesian3.subtract(nextPosition, position, forward),
forward,
);
cornerDirection = Cartesian3.normalize(
Cartesian3.add(forward, backward, cornerDirection),
cornerDirection,
);

const forwardProjection = Cartesian3.multiplyByScalar(
normal,
Expand All @@ -284,6 +280,10 @@ CorridorGeometryLibrary.computePositions = function (params) {
);

if (doCorner) {
cornerDirection = Cartesian3.normalize(
Cartesian3.add(forward, backward, cornerDirection),
cornerDirection,
);
cornerDirection = Cartesian3.cross(
cornerDirection,
normal,
Expand Down
4 changes: 2 additions & 2 deletions packages/engine/Source/Core/PolylineVolumeGeometryLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,6 @@ PolylineVolumeGeometryLibrary.computePositions = function (
}
forward = Cartesian3.subtract(nextPosition, position, forward);
forward = Cartesian3.normalize(forward, forward);
cornerDirection = Cartesian3.add(forward, backward, cornerDirection);
cornerDirection = Cartesian3.normalize(cornerDirection, cornerDirection);
surfaceNormal = ellipsoid.geodeticSurfaceNormal(position, surfaceNormal);

const forwardProjection = Cartesian3.multiplyByScalar(
Expand All @@ -461,6 +459,8 @@ PolylineVolumeGeometryLibrary.computePositions = function (
);

if (doCorner) {
cornerDirection = Cartesian3.add(forward, backward, cornerDirection);
cornerDirection = Cartesian3.normalize(cornerDirection, cornerDirection);
cornerDirection = Cartesian3.cross(
cornerDirection,
surfaceNormal,
Expand Down