mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-25 01:45:26 +01:00
fix PIP classification bug / test
This commit is contained in:
parent
2b95217c73
commit
94464b269c
3 changed files with 26 additions and 4 deletions
|
|
@ -1160,7 +1160,7 @@ export function classifyPointInsideLoop( inPt, loop, tr ) {
|
|||
edgeLowPt = b; edgeDx = - edgeDx;
|
||||
edgeHighPt = a; edgeDy = - edgeDy;
|
||||
}
|
||||
if (!aEq && !bEq && ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) {
|
||||
if (!aEq && !bEq && ( inPt.y < edgeLowPt.y || inPt.y > edgeHighPt.y ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ export default {
|
|||
{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,-169.15430109914888],[37,24.438723388262304]],[38,[39,-44.56473088447832],[40,170.1126824084925]]],"children":[41]},
|
||||
{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,-44.56473088447832],[44,170.1126824084925]],[45,[46,-250],[47,250]]],"children":[48]}]}]} );
|
||||
|
||||
app.actionManager.actions['CUT'].invoke(app);
|
||||
app.ui.registeredWizard.okClick();
|
||||
cut(app, '0:3', 50);
|
||||
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,250],[-250,24.438723388262304,-169.15430109914888],[-250,170.1126824084925,-44.56473088447832],[-250,250,-250],[-250,250,250],[-200,24.438723388262304,-169.15430109914888],[-200,170.1126824084925,-44.56473088447832],[-200,250,-250],[250,-250,-250],[250,-250,250],[250,250,-250],[250,250,250]],"faces":[[[9,10,1,0]],[[11,12,10,9]],[[4,5,12,11,8]],[[4,3,2,4,0,1,5]],[[5,1,10,12]],[[0,4,8,11,9]],[[4,2,6,8]],[[2,3,7,6]],[[3,4,8,7]],[[6,7,8]]]});
|
||||
env.done();
|
||||
}));
|
||||
|
|
@ -28,7 +27,7 @@ export default {
|
|||
cut(app, '0:1', 500);
|
||||
setSketch(win, app, '2:0', {"layers":[{"name":"sketch","data":[{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,-379.56770796200084],[51,-40.45650878155793]],[52,[53,-5.818373610536707],[54,-40.45650878155793]]],"children":[55]},{"id":62,"_class":"TCAD.TWO.Segment","points":[[56,[57,-5.818373610536707],[58,-40.45650878155793]],[59,[60,-5.818373610536707],[61,-354.50976889632983]]],"children":[62]},{"id":69,"_class":"TCAD.TWO.Segment","points":[[63,[64,-5.818373610536707],[65,-354.50976889632983]],[66,[67,-379.56770796200084],[68,-354.50976889632983]]],"children":[69]},{"id":76,"_class":"TCAD.TWO.Segment","points":[[70,[71,-379.56770796200084],[72,-354.50976889632983]],[73,[74,-379.56770796200084],[75,-40.45650878155793]]],"children":[76]}]}]});
|
||||
cut(app, '2:0', 50);
|
||||
//assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,250],[-250,24.438723388262304,-169.15430109914888],[-250,170.1126824084925,-44.56473088447832],[-250,250,-250],[-250,250,250],[-200,24.438723388262304,-169.15430109914888],[-200,170.1126824084925,-44.56473088447832],[-200,250,-250],[250,-250,-250],[250,-250,250],[250,250,-250],[250,250,250]],"faces":[[[9,10,1,0]],[[11,12,10,9]],[[4,5,12,11,8]],[[4,3,2,4,0,1,5]],[[5,1,10,12]],[[0,4,8,11,9]],[[4,2,6,8]],[[2,3,7,6]],[[3,4,8,7]],[[6,7,8]]]});
|
||||
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,250],[-250,57.176503480539594,-250],[-250,57.176503480539594,-45.42896723585416],[-250,250,-45.42896723585416],[-250,250,250],[-154.2442837314632,-250,-17.236467236467238],[-154.2442837314632,-250,173.69055445978523],[-154.2442837314632,250,-17.236467236467238],[-154.2442837314632,250,173.69055445978523],[148.94075535101177,-250,-17.236467236467238],[148.94075535101177,-250,173.69055445978523],[148.94075535101177,250,-17.236467236467238],[148.94075535101177,250,173.69055445978523],[200,-250,5.818373610536707],[200,-250,250],[200,-40.45650878155793,5.818373610536707],[200,-40.45650878155793,250],[250,-250,-250],[250,-250,5.818373610536696],[250,-40.45650878155794,250],[250,-40.45650878155793,5.818373610536707],[250,57.176503480539594,-250],[250,57.176503480539594,-45.42896723585416],[250,250,-45.42896723585416],[250,250,250]],"faces":[[[14,15,1,0,18,19],[6,7,11,10]],[[21,19,18,22,23,24,25,20]],[[25,24,4,5],[9,8,12,13]],[[4,3,2,0,1,5]],[[15,17,20,25,5,1]],[[0,2,22,18]],[[6,10,12,8]],[[7,6,8,9]],[[11,7,9,13]],[[10,11,13,12]],[[4,24,23,3]],[[3,23,22,2]],[[14,19,21,16]],[[20,17,16,21]],[[17,15,14,16]]]});
|
||||
env.done();
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -615,6 +615,29 @@ export default {
|
|||
}));
|
||||
},
|
||||
|
||||
/**
|
||||
* o--------o
|
||||
* | |
|
||||
* | *--> o
|
||||
* | |
|
||||
* o-o------o
|
||||
*/
|
||||
testPIPClassificationConvexPointAndPointInRound: function (env) {
|
||||
test.modeller(env.test((win, app) => {
|
||||
const loop = createLoop(app.TPI,[
|
||||
[173.69055445978523, -250],
|
||||
[173.69055445978523, -40.45650878155794],
|
||||
[173.69055445978523, 250],
|
||||
[-17.236467236467238, 250],
|
||||
[-17.236467236467238, -250],
|
||||
[5.818373610536707, -250]
|
||||
]);
|
||||
|
||||
const result = classify(app, win, loop, [5.818373610536707, -40.45650878155793]);
|
||||
env.assertTrue(result.inside);
|
||||
env.done();
|
||||
}));
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue