Skip to content
7 changes: 1 addition & 6 deletions src/extras/BuildingShapeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ class BuildingShapeUtils extends ShapeUtils {
*/
static combineCoordinates(shape) {
const points = shape.extractPoints().shape;
points.pop();
var x = [];
var y = [];
var vec;
Expand Down Expand Up @@ -337,7 +336,6 @@ class BuildingShapeUtils extends ShapeUtils {
*/
static edgeLength(shape) {
const points = shape.extractPoints().shape;
points.pop();
const lengths = [];
var p1;
var p2;
Expand All @@ -359,7 +357,6 @@ class BuildingShapeUtils extends ShapeUtils {
*/
static vertexAngle(shape) {
const points = shape.extractPoints().shape;
points.pop();
const angles = [];
var p0;
var p1;
Expand Down Expand Up @@ -394,7 +391,6 @@ class BuildingShapeUtils extends ShapeUtils {
*/
static edgeDirection(shape) {
const points = shape.extractPoints().shape;
points.pop();
const angles = [];
var p1;
var p2;
Expand All @@ -418,7 +414,6 @@ class BuildingShapeUtils extends ShapeUtils {
static surrounds(shape, point) {
var count = 0;
const vecs = shape.extractPoints().shape;
vecs.pop();
var vec;
var nextvec;
for (let i = 0; i < vecs.length; i++) {
Expand Down Expand Up @@ -468,7 +463,7 @@ class BuildingShapeUtils extends ShapeUtils {
* Return the angle of the longest side of a shape with 90° vertices.
*
* @param {THREE.Shape} shape - the shape
* @return {number}
* @return {number} in radians from Pi > x > -Pi
*/
static longestSideAngle(shape) {
const lengths = BuildingShapeUtils.edgeLength(shape);
Expand Down
2 changes: 2 additions & 0 deletions test/buildingpart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ test('Constructor', () => {
expect(part.options.roof.orientation).toBe('along');

// toDo: Mock BuildingShapeUtils and test options
expect(BuildingShapeUtils.edgeDirection(part.shape)).toStrictEqual([1.5707963267948966, 0, -1.5707963267948966, 3.141592653589793]);
expect(BuildingShapeUtils.longestSideAngle(part.shape)).toBe(1.5707963267948966);
expect(part.options.roof.direction).toBe(90);
expect(errors.length).toBe(0);
});
Expand Down
3 changes: 0 additions & 3 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,17 @@ const rightTriangle = new Shape();
rightTriangle.moveTo(1, 1);
rightTriangle.lineTo(1, -1);
rightTriangle.lineTo(-1, 1);
rightTriangle.lineTo(1, 1);

const rightTriangle2 = new Shape();
rightTriangle2.moveTo(1, 1);
rightTriangle2.lineTo(-1, 1);
rightTriangle2.lineTo(1, -1);
rightTriangle2.lineTo(1, 1);

const rectangle = new Shape();
rectangle.moveTo(-4.332738077015795, -5.882209888874915);
rectangle.lineTo(-4.332738077015795, 5.88221335051411);
rectangle.lineTo(4.332747472106493, 5.88221335051411);
rectangle.lineTo(4.332747472106493, -5.882209888874915);
rectangle.lineTo(-4.332738077015795, -5.882209888874915);

test('Extents no Rotation', () => {
expect(BuildingShapeUtils.extents(rightTriangle)).toStrictEqual([-1, -1, 1, 1]);
Expand Down