Skip to content

Commit

Permalink
small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson committed Jan 4, 2024
1 parent cd34e17 commit 73278b3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/splitter/EdgeGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Vector3, Line3, Triangle } from 'three';
import { lineIntersect } from './utils.js';
import { ObjectPool } from './ObjectPool.js';

const _vec = new Vector3();

class GraphTriangle extends Triangle {

constructor( ...args ) {
Expand Down Expand Up @@ -193,6 +195,7 @@ export class EdgeGraph {
other.endIndex !== inserting.endIndex
) {

// TODO: remove this point?
const point = pointPool.getInstance();
if ( lineIntersect( inserting, other, point ) ) {

Expand Down Expand Up @@ -245,11 +248,10 @@ export class EdgeGraph {
if ( index === null ) {

// if we haven't been able to match a point see if we can find an existing edge it sits on
const vec = pointPool.getInstance();
const intersectingEdge = edges.findIndex( e => {

e.closestPointToPoint( point, true, vec );
return vec.distanceTo( point ) < EPSILON;
e.closestPointToPoint( point, true, _vec );
return _vec.distanceTo( point ) < EPSILON;

} );

Expand Down

0 comments on commit 73278b3

Please sign in to comment.