Skip to content

Commit

Permalink
fixup! SceneGadget : Add normalAt` method
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Mar 5, 2024
1 parent 009cb96 commit d453c3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GafferSceneUI/SceneGadget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,8 @@ std::optional<V3f> SceneGadget::normalAt( const IECore::LineSegment3f &lineInGad

// Transforming from raster to gadget space (done by `Widget`) and back to raster space
// can introduce enough floating point error to make positions, and therefore normals,
// incorrect. We know that the incoming `lineInGadgetSpace` has been calculated from
// an integeer pixel value so we snap to the nearest integer as a corrective.
// incorrect. We expect that `lineInGadgetSpace` corresponds to the center of a pixel,
// so we snap to the nearest center as a corrective.
V2f centerRasterP = viewportGadget->gadgetToRasterSpace( lineInGadgetSpace.p0, this );
centerRasterP.x = (int)centerRasterP.x + 0.5f;
centerRasterP.y = (int)centerRasterP.y + 0.5f;
Expand Down

0 comments on commit d453c3f

Please sign in to comment.