Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## Unreleased

### Added

- `CompoundFlags::FIX_INTERNAL_EDGES` makes a `Compound` treat the edges (2D) or faces (3D) its parts share as
interior to the union, so a body sliding across the cut between two parts of a convex
decomposition no longer catches on it. `Compound::PartNormalConstraints` is now
`CompoundPseudoNormals`, matching what `TriMesh` and `Polyline` already provide.

## 0.30.2

### Added
Expand Down
16 changes: 5 additions & 11 deletions src/query/point/point_segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,20 @@ impl PointQueryWithLocation for Segment {
let ab_ap = ab.dot(ap);
let sqnab = ab.length_squared();

let proj;
let location;

if ab_ap <= 0.0 {
let (location, proj) = if ab_ap <= 0.0 {
// Voronoï region of vertex 'a'.
location = SegmentPointLocation::OnVertex(0);
proj = self.a;
(SegmentPointLocation::OnVertex(0), self.a)
} else if ab_ap >= sqnab {
// Voronoï region of vertex 'b'.
location = SegmentPointLocation::OnVertex(1);
proj = self.b;
(SegmentPointLocation::OnVertex(1), self.b)
} else {
assert!(sqnab != 0.0);

// Voronoï region of the segment interior.
let u = ab_ap / sqnab;
let bcoords = [1.0 - u, u];
location = SegmentPointLocation::OnEdge(bcoords);
proj = self.a + ab * u;
}
(SegmentPointLocation::OnEdge(bcoords), self.a + ab * u)
};

// TODO: is this acceptable?
let inside = relative_eq_vector(proj, pt);
Expand Down
Loading
Loading