You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note this includes modifications to account for non-connected faces, as well as some var-to-lets and a new constructor option to pass precalculated geometry and bypass some calculations.
@@ -508,7 +521,7 @@ export class ConvexPolyhedron extends Shape {
508
521
509
522
if(depth<=maxDist){
510
523
constpoint=pVtxIn[i]
511
-
if(depth<=0){
524
+
if(depth<=1e-6){
512
525
constp={
513
526
point,
514
527
normal: planeNormalWS,
@@ -736,34 +749,36 @@ export class ConvexPolyhedron extends Shape {
736
749
// Apply rotation
737
750
if(quat){
738
751
// Rotate vertices
739
-
for(vari=0;i<n;i++){
752
+
for(leti=0;i<n;i++){
740
753
varv=verts[i]
741
754
quat.vmult(v,v)
742
755
}
743
756
// Rotate face normals
744
-
for(vari=0;i<this.faceNormals.length;i++){
757
+
for(leti=0;i<this.faceNormals.length;i++){
745
758
varv=this.faceNormals[i]
746
759
quat.vmult(v,v)
747
760
}
748
761
/*
749
762
// Rotate edges
750
-
for(var i=0; i<this.uniqueEdges.length; i++){
763
+
for(let i=0; i<this.uniqueEdges.length; i++){
751
764
var v = this.uniqueEdges[i];
752
765
quat.vmult(v,v);
753
766
}*/
754
767
}
755
768
756
769
// Apply offset
757
770
if(offset){
758
-
for(vari=0;i<n;i++){
771
+
for(leti=0;i<n;i++){
759
772
varv=verts[i]
760
773
v.vadd(offset,v)
761
774
}
762
775
}
763
776
}
764
777
765
778
/**
766
-
* Checks whether p is inside the polyhedra. Must be in local coords. The point lies outside of the convex hull of the other points if and only if the direction of all the vectors from it to those other points are on less than one half of a sphere around it.
779
+
* Checks whether p is inside the polyhedra. Must be in local coords.
780
+
* The point lies outside of the convex hull of the other points if and only if the direction
781
+
* of all the vectors from it to those other points are on less than one half of a sphere around it.
767
782
* @method pointIsInside
768
783
* @param {Vec3} p A point given in local coordinates
0 commit comments