Skip to content

Commit

Permalink
Fix normals flipping when z is negative (could have a better solution)
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Dec 15, 2023
1 parent c9c4483 commit c8b97fa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions web/shapeworks/src/reader/constraints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ export function convertConstraintDataForDB(constraintData) {
const v2 = crossProduct(normal, [0, 1, 0])

const p1 = origin;
const p2 = addVectors(origin, v2)
const p3 = addVectors(origin, v1)
// TODO: sometimes normals are flipped
const p2 = addVectors(origin, normal[2] > 0 ? v2 : v1)
const p3 = addVectors(origin, normal[2] > 0 ? v1 : v2)

constraintJSON.planes.push({points: [p1, p2, p3]})
} else if (cData.type === 'paint') {
Expand Down

0 comments on commit c8b97fa

Please sign in to comment.