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

Avoid duplicated checks for valid shape in TangibleConnectionModel #401

Closed
samreid opened this issue Mar 2, 2023 · 1 comment
Closed
Assignees

Comments

@samreid
Copy link
Member

samreid commented Mar 2, 2023

Discovered in #398, @jessegreenberg and @matthew-blackman and I were looking at

// No lines intersect
// REVIEW: Could this be simpler?
if ( allowed ) {
for ( let i = 0; i < proposedLines.length; i++ ) {
const firstLine = proposedLines[ i ];
for ( let j = 0; j < proposedLines.length; j++ ) {
const secondLine = proposedLines[ j ];
if ( firstLine !== secondLine ) {
if ( Line.intersectOther( firstLine, secondLine ).length > 0 ) {
allowed = false;
break;
}
}
}
if ( !allowed ) {
break;
}
}
}
and wondering if it would be better to create a scratch QuadrilateralShapeModel then ask if it is a valid shape? We think there may be duplicated logic here.

@jessegreenberg
Copy link
Contributor

The code referenced here is totally removed, and its using QuadrilateralShapeModel.isQuadrilateralShapeAllowed( testShapeModel ); instead. So much nicer!

I was able to test it with ?cameraInput=hands, and it is working well, maybe even better - before the change I was seeing what looked like incorrect shapes sometimes. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants