brep operand mode / debug framework

This commit is contained in:
Val Erastov 2017-02-10 20:30:32 -08:00
parent bec41373d8
commit effc9b0543

View file

@ -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;