Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ply normals #429

Merged
merged 3 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -20,6 +20,7 @@

import boofcv.struct.PackedArray;
import boofcv.struct.packed.GenericPackedArrayChecks;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -50,4 +51,7 @@ class TestPackedTupleArray_B extends GenericPackedArrayChecks<TupleDesc_B> {
}
fail("The tuples are identical");
}

// not implemented yet
@Test void setTo_Standard(){}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -21,6 +21,7 @@
import boofcv.struct.PackedArray;
import boofcv.struct.packed.GenericPackedArrayChecks;
import org.ejml.UtilEjml;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -51,4 +52,7 @@ class TestPackedTupleArray_F64 extends GenericPackedArrayChecks<TupleDesc_F64> {
}
fail("The tuples are identical");
}

// not implemented yet
@Test void setTo_Standard(){}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -20,6 +20,7 @@

import boofcv.struct.PackedArray;
import boofcv.struct.packed.GenericPackedArrayChecks;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -50,4 +51,7 @@ class TestPackedTupleArray_S8 extends GenericPackedArrayChecks<TupleDesc_S8> {
}
fail("The tuples are identical");
}

// not implemented yet
@Test void setTo_Standard(){}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -20,6 +20,7 @@

import boofcv.struct.PackedArray;
import boofcv.struct.packed.GenericPackedArrayChecks;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -50,4 +51,7 @@ class TestPackedTupleArray_U8 extends GenericPackedArrayChecks<TupleDesc_U8> {
}
fail("The tuples are identical");
}

// not implemented yet
@Test void setTo_Standard(){}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -20,6 +20,7 @@

import boofcv.struct.PackedArray;
import boofcv.struct.packed.GenericPackedArrayChecks;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -50,4 +51,7 @@ class TestPackedTupleBigArray_B extends GenericPackedArrayChecks<TupleDesc_B> {
}
fail("The tuples are identical");
}

// not implemented yet
@Test void setTo_Standard(){}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -21,6 +21,7 @@
import boofcv.struct.PackedArray;
import boofcv.struct.packed.GenericPackedArrayChecks;
import org.ejml.UtilEjml;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -51,4 +52,7 @@ class TestPackedTupleBigArray_F64 extends GenericPackedArrayChecks<TupleDesc_F64
}
fail("The tuples are identical");
}

// not implemented yet
@Test void setTo_Standard(){}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -20,6 +20,7 @@

import boofcv.struct.PackedArray;
import boofcv.struct.packed.GenericPackedArrayChecks;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -50,4 +51,7 @@ class TestPackedTupleBigArray_S8 extends GenericPackedArrayChecks<TupleDesc_S8>
}
fail("The tuples are identical");
}

// not implemented yet
@Test void setTo_Standard(){}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand All @@ -20,6 +20,7 @@

import boofcv.struct.PackedArray;
import boofcv.struct.packed.GenericPackedArrayChecks;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -50,4 +51,7 @@ class TestPackedTupleBigArray_U8 extends GenericPackedArrayChecks<TupleDesc_U8>
}
fail("The tuples are identical");
}

// not implemented yet
@Test void setTo_Standard(){}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Peter Abeles. All Rights Reserved.
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand Down Expand Up @@ -63,6 +63,9 @@ public class StlDataStructure {
/** What's the name of this Solid */
public String name = "";

// Internal workspace
Point3D_F64 temp = new Point3D_F64();

public void reset() {
vertexes.reset();
normals.reset();
Expand Down Expand Up @@ -124,15 +127,14 @@ private void addNormal( Point3D_F64 v1, Point3D_F64 v2, Point3D_F64 v3 ) {
double by = v3.y - v1.y;
double bz = v3.z - v1.z;

Point3D_F64 t = vertexes.temp;
GeometryMath_F64.cross(ax, ay, az, bx, by, bz, t);
GeometryMath_F64.cross(ax, ay, az, bx, by, bz, temp);

// Ensure the norm is 1
double n = t.norm();
t.divideIP(n);
double n = temp.norm();
temp.divideIP(n);

// Save the results
normals.append(t.x, t.y, t.z);
normals.append(temp.x, temp.y, temp.z);
}

/**
Expand Down
Loading
Loading