adding more topological tests for boolean operation

This commit is contained in:
Val Erastov 2018-02-07 22:58:52 -08:00
parent 2e5ad6ad43
commit 4836b89595

View file

@ -117,6 +117,70 @@ export default defineTests([
'vertices': [[-250, -250, -250], [-250, -250, 250], [-250, 200, -106], [-250, 200, 144], [-250, 250, -250], [-250, 250, -106], [-250, 250, 144], [-250, 250, 250], [-92, 200, -106], [-92, 200, 144], [-92, 250, -106], [-92, 250, 144], [-30, 200, -99], [-30, 200, 145], [-30, 250, -99], [-30, 250, 145], [172, 200, -99], [172, 200, 145], [172, 250, -99], [172, 250, 145], [250, -250, -250], [250, -250, 250], [250, 250, -250], [250, 250, 250]],
'faces': [[[0, 20, 21, 1]], [[20, 22, 23, 21]], [[3, 2, 5, 4, 0, 1, 7, 6]], [[23, 7, 1, 21]], [[22, 20, 0, 4]], [[17, 19, 18, 16]], [[16, 18, 14, 12]], [[12, 14, 15, 13]], [[13, 15, 19, 17]], [[11, 10, 8, 9]], [[5, 2, 8, 10]], [[3, 6, 11, 9]], [[2, 3, 9, 8]], [[16, 12, 13, 17]], [[10, 11, 6, 7, 23, 22, 4, 5], [15, 14, 18, 19]]]
}
},
{
'name': 'StickingOut2FacesHalfCut',
'state': {
'sketches': {'0:3': {'Segment': [[[-21, 426], [464, 426]], [[464, 426], [464, -8]], [[464, -8], [-21, -8]], [[-21, -8], [-21, 426]]]}},
'operations': [{'type': 'BOX', 'params': {'width': 500, 'height': 500, 'depth': 500}}, {
'type': 'CUT',
'params': {'value': 250, 'prism': 1, 'angle': 0, 'rotation': 0, 'face': '0:3'}
}]
},
'expected': {
'format': 'LOOPS',
'vertices': [[-250, -250, -250], [-250, -250, 250], [-250, -8, -21], [-250, -8, 250], [-250, 250, -250], [-250, 250, -21], [0, -8, -21], [0, -8, 250], [0, 250, -21], [0, 250, 250], [250, -250, -250], [250, -250, 250], [250, 250, -250], [250, 250, 250]],
'faces': [[[10, 11, 1, 0]], [[12, 13, 11, 10]], [[8, 9, 13, 12, 4, 5]], [[9, 7, 3, 1, 11, 13]], [[10, 0, 4, 12]], [[8, 5, 2, 6]], [[3, 7, 6, 2]], [[7, 9, 8, 6]], [[3, 2, 5, 4, 0, 1]]]
}
},
{
'name': 'StickingOut2FacesFullCut',
'state': {
'sketches': {'0:3': {'Segment': [[[-21, 426], [464, 426]], [[464, 426], [464, -8]], [[464, -8], [-21, -8]], [[-21, -8], [-21, 426]]]}},
'operations': [{'type': 'BOX', 'params': {'width': 500, 'height': 500, 'depth': 500}}, {
'type': 'CUT',
'params': {'value': 500, 'prism': 1, 'angle': 0, 'rotation': 0, 'face': '0:3'}
}]
},
'expected': {
'format': 'LOOPS',
'vertices': [[-250, -250, -250], [-250, -250, 250], [-250, -8, -21], [-250, -8, 250], [-250, 250, -250], [-250, 250, -21], [250, -250, -250], [250, -250, 250], [250, -8, -21], [250, -8, 250], [250, 250, -250], [250, 250, -21]],
'faces': [[[6, 7, 1, 0]], [[5, 11, 10, 4]], [[9, 3, 1, 7]], [[6, 0, 4, 10]], [[11, 5, 2, 8]], [[3, 9, 8, 2]], [[11, 8, 9, 7, 6, 10]], [[3, 2, 5, 4, 0, 1]]]
}
},
{
'name': 'StickingOut2FacesHalfUnion',
'state': {
'sketches': {'0:3': {'Segment': [[[-21, 426], [464, 426]], [[464, 426], [464, -8]], [[464, -8], [-21, -8]], [[-21, -8], [-21, 426]]]}},
'operations': [{'type': 'BOX', 'params': {'width': 500, 'height': 500, 'depth': 500}}, {
'type': 'EXTRUDE',
'params': {'value': -250, 'prism': 1, 'angle': 0, 'rotation': 0, 'face': '0:3'}
}]
},
'expected': {
'format': 'LOOPS',
'vertices': [[-250, -250, -250], [-250, -250, 250], [-250, -8, 250], [-250, -8, 464], [-250, 250, -250], [-250, 250, -21], [-250, 426, -21], [-250, 426, 464], [0, -8, 250], [0, -8, 464], [0, 250, -21], [0, 250, 250], [0, 426, -21], [0, 426, 464], [250, -250, -250], [250, -250, 250], [250, 250, -250], [250, 250, 250]],
'faces': [[[14, 15, 1, 0]], [[16, 17, 15, 14]], [[10, 11, 17, 16, 4, 5]], [[11, 8, 2, 1, 15, 17]], [[14, 0, 4, 16]], [[10, 5, 6, 12]], [[2, 8, 9, 3]], [[13, 7, 3, 9]], [[12, 6, 7, 13]], [[8, 11, 10, 12, 13, 9]], [[3, 7, 6, 5, 4, 0, 1, 2]]]
}
},
{
'name': 'StickingOut2FacesFullUnion',
'state': {
'sketches': {'0:3': {'Segment': [[[-21, 426], [464, 426]], [[464, 426], [464, -8]], [[464, -8], [-21, -8]], [[-21, -8], [-21, 426]]]}},
'operations': [{'type': 'BOX', 'params': {'width': 500, 'height': 500, 'depth': 500}}, {
'type': 'EXTRUDE',
'params': {'value': -500, 'prism': 1, 'angle': 0, 'rotation': 0, 'face': '0:3'}
}]
},
'expected': {
'format': 'LOOPS',
'vertices': [[-250, -250, -250], [-250, -250, 250], [-250, -8, 250], [-250, -8, 464], [-250, 250, -250], [-250, 250, -21], [-250, 426, -21], [-250, 426, 464], [250, -250, -250], [250, -250, 250], [250, -8, 250], [250, -8, 464], [250, 250, -250], [250, 250, -21], [250, 426, -21], [250, 426, 464]],
'faces': [[[8, 9, 1, 0]], [[5, 13, 12, 4]], [[10, 2, 1, 9]], [[8, 0, 4, 12]], [[13, 5, 6, 14]], [[2, 10, 11, 3]], [[15, 7, 3, 11]], [[14, 6, 7, 15]], [[12, 13, 14, 15, 11, 10, 9, 8]], [[3, 7, 6, 5, 4, 0, 1, 2]]]
}
}
]);