mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-14 20:33:30 +01:00
brep operand mode / debug framework
This commit is contained in:
parent
bec41373d8
commit
effc9b0543
1 changed files with 15 additions and 9 deletions
|
|
@ -14,8 +14,8 @@ export const TOLERANCE_SQ = TOLERANCE * TOLERANCE;
|
|||
export const TOLERANCE_HALF = TOLERANCE * 0.5;
|
||||
|
||||
const DEBUG = {
|
||||
OPERANDS_MODE: false,
|
||||
LOOP_DETECTION: false,
|
||||
OPERANDS_MODE: true,
|
||||
LOOP_DETECTION: true,
|
||||
FACE_FACE_INTERSECTION: false,
|
||||
FACE_EDGE_INTERSECTION: false,
|
||||
SEWING: false,
|
||||
|
|
@ -23,7 +23,6 @@ const DEBUG = {
|
|||
NOOP: () => {}
|
||||
};
|
||||
|
||||
|
||||
const TYPE = {
|
||||
UNION: 0,
|
||||
INTERSECT: 1,
|
||||
|
|
@ -31,14 +30,17 @@ const TYPE = {
|
|||
};
|
||||
|
||||
export function union( shell1, shell2 ) {
|
||||
__DEBUG_OPERANDS(shell1, shell2);
|
||||
return BooleanAlgorithm(shell1, shell2, TYPE.UNION);
|
||||
}
|
||||
|
||||
export function intersect( shell1, shell2 ) {
|
||||
__DEBUG_OPERANDS(shell1, shell2);
|
||||
return BooleanAlgorithm(shell1, shell2, TYPE.INTERSECT);
|
||||
}
|
||||
|
||||
export function subtract( shell1, shell2 ) {
|
||||
__DEBUG_OPERANDS(shell1, shell2);
|
||||
invert(shell2);
|
||||
return BooleanAlgorithm(shell1, shell2, TYPE.SUBTRACT);
|
||||
}
|
||||
|
|
@ -65,11 +67,6 @@ export function BooleanAlgorithm( shell1, shell2, type ) {
|
|||
|
||||
POINT_TO_VERT.clear();
|
||||
|
||||
if (DEBUG.OPERANDS_MODE) {
|
||||
__DEBUG__.HideSolids();
|
||||
__DEBUG__.AddVolume(shell1, 0x800080);
|
||||
__DEBUG__.AddVolume(shell2, 0xfff44f);
|
||||
}
|
||||
let facesData = [];
|
||||
|
||||
mergeVertices(shell1, shell2);
|
||||
|
|
@ -155,6 +152,7 @@ export function BooleanAlgorithm( shell1, shell2, type ) {
|
|||
|
||||
cleanUpSolveData(result);
|
||||
BREPValidator.validateToConsole(result);
|
||||
if (DEBUG.OPERANDS_MODE) __DEBUG__.ClearVolumes();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -1219,5 +1217,13 @@ function removeFromListInMap(map, key, value) {
|
|||
}
|
||||
}
|
||||
|
||||
function __DEBUG_OPERANDS(shell1, shell2) {
|
||||
if (DEBUG.OPERANDS_MODE) {
|
||||
__DEBUG__.HideSolids();
|
||||
__DEBUG__.AddVolume(shell1, 0x800080);
|
||||
__DEBUG__.AddVolume(shell2, 0xfff44f);
|
||||
}
|
||||
}
|
||||
|
||||
const MY = '__BOOLEAN_ALGORITHM_DATA__';
|
||||
let xxx = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue