Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This support class contains imformation
- * on the mesh that is used to output
- * an STL file.
- * */
- public class Mesh {
- float[][] vertices;
- int[] triangles;
- public Mesh() {
- }
- public Mesh(float[][] v, int[] t) {
- vertices = v;
- triangles = t;
- }
- public void setVertice(int index, int dimension, float value) {
- vertices[index][dimension] = value;
- }
- public float getVertice(int index, int dimension) {
- return vertices[index][dimension];
- }
- public int getNumVertices() {
- return vertices.length;
- }
- public int getNumTriangles() {
- return triangles.length;
- }
- public float[][] getFacetFromIndex(int index) {
- float[][] facet = new float[3][3];
- for (int i = 0; i < 3; i++) {
- for (int n = 0; n < 3; n++) {
- facet[i][n] = vertices[triangles[i+index]][n];
- }
- }
- return facet;
- }
- }
Add Comment
Please, Sign In to add comment