aboutsummaryrefslogtreecommitdiffstats
path: root/cad/meshdev
diff options
context:
space:
mode:
authorgahr <gahr@FreeBSD.org>2012-02-06 23:57:20 +0800
committergahr <gahr@FreeBSD.org>2012-02-06 23:57:20 +0800
commit59a1a7ec0f88fdb5c506d819f10b03946ad66e89 (patch)
tree01b2de3b0c0f4e4cb61f66570efa5c532242bc99 /cad/meshdev
parentbafd693a5f8723e34af2eb27f8d93b8854e25ce7 (diff)
downloadfreebsd-ports-gnome-59a1a7ec0f88fdb5c506d819f10b03946ad66e89.tar.gz
freebsd-ports-gnome-59a1a7ec0f88fdb5c506d819f10b03946ad66e89.tar.zst
freebsd-ports-gnome-59a1a7ec0f88fdb5c506d819f10b03946ad66e89.zip
- New port: cad/meshdev
MeshDev is a mesh comparison software. It accepts two meshes as input and computes the geometrical deviation between the two meshes. It return numerical values and can optionaly generate visual results (with a pseudo-colored mesh corresponding to the measured deviation) in OpenInventor format. This port features a patch (by myself) to read binary and ASCII STL files. This feature was removed in the transition from version 0.4 -> 0.5. Distfiles are unfetchable from sourceforce. For this reason, they're hosted on our infrastructure. WWW: http://meshdev.sourceforge.net/
Diffstat (limited to 'cad/meshdev')
-rw-r--r--cad/meshdev/Makefile27
-rw-r--r--cad/meshdev/distinfo2
-rw-r--r--cad/meshdev/files/patch-build_Makefile.release.gcc21
-rw-r--r--cad/meshdev/files/patch-src_FileSTL.cpp153
-rw-r--r--cad/meshdev/files/patch-src_FileSTL.h39
-rw-r--r--cad/meshdev/files/patch-src_Mesh.cpp34
-rw-r--r--cad/meshdev/files/patch-src_Mesh.h12
-rw-r--r--cad/meshdev/pkg-descr7
8 files changed, 295 insertions, 0 deletions
diff --git a/cad/meshdev/Makefile b/cad/meshdev/Makefile
new file mode 100644
index 000000000000..d70cda392f29
--- /dev/null
+++ b/cad/meshdev/Makefile
@@ -0,0 +1,27 @@
+# New ports collection Makefile for: meshdev
+# Date created: 6 February 2012
+# Whom: gahr
+#
+# $FreeBSD$
+#
+
+PORTNAME= meshdev
+PORTVERSION= 0.5
+CATEGORIES= cad
+MASTER_SITES= ${MASTER_SITE_LOCAL}/gahr/ \
+ http://people.freebsd.org/~gahr/distfiles/
+
+MAINTAINER= gahr@FreeBSD.org
+COMMENT= A mesh comparison software
+
+BUILD_WRKSRC= ${WRKSRC}/build
+INSTALL_WRKSRC= ${WRKSRC}/bin
+
+MAKEFILE= Makefile.release.gcc
+
+PLIST_FILES= bin/${PORTNAME}
+
+do-install:
+ ${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/${PORTNAME} ${PREFIX}/bin
+
+.include <bsd.port.mk>
diff --git a/cad/meshdev/distinfo b/cad/meshdev/distinfo
new file mode 100644
index 000000000000..5da15a62388d
--- /dev/null
+++ b/cad/meshdev/distinfo
@@ -0,0 +1,2 @@
+SHA256 (meshdev-0.5.tar.gz) = d9b31f803903e632211085cf971310eb872b782b8153cfff25f42b33fc76a1bc
+SIZE (meshdev-0.5.tar.gz) = 110918
diff --git a/cad/meshdev/files/patch-build_Makefile.release.gcc b/cad/meshdev/files/patch-build_Makefile.release.gcc
new file mode 100644
index 000000000000..0e69947fc7c2
--- /dev/null
+++ b/cad/meshdev/files/patch-build_Makefile.release.gcc
@@ -0,0 +1,21 @@
+--- build/Makefile.release.gcc.orig 2012-02-06 16:12:55.000000000 +0100
++++ build/Makefile.release.gcc 2012-02-06 16:13:07.000000000 +0100
+@@ -2,7 +2,7 @@
+ # Makefile created by Michaël Roy
+
+ CXX = g++
+-OBJ = tmp/Deviation.o tmp/FileVrml1.o tmp/FileVrml2.o tmp/Mesh.o tmp/MeshDev.o tmp/Neighborhood.o tmp/Sample.o tmp/UniformGrid.o
++OBJ = tmp/Deviation.o tmp/FileVrml1.o tmp/FileVrml2.o tmp/FileSTL.o tmp/Mesh.o tmp/MeshDev.o tmp/Neighborhood.o tmp/Sample.o tmp/UniformGrid.o
+ BIN = ../bin/meshdev
+ CFLAGS += -DNDEBUG -Wall -W -ansi -pedantic -s -O2
+
+@@ -25,6 +25,9 @@
+ tmp/FileVrml2.o: ../src/FileVrml2.cpp
+ $(CXX) -c ../src/FileVrml2.cpp -o tmp/FileVrml2.o $(CFLAGS)
+
++tmp/FileSTL.o: ../src/FileSTL.cpp
++ $(CXX) -c ../src/FileSTL.cpp -o tmp/FileSTL.o $(CFLAGS)
++
+ tmp/Mesh.o: ../src/Mesh.cpp
+ $(CXX) -c ../src/Mesh.cpp -o tmp/Mesh.o $(CFLAGS)
+
diff --git a/cad/meshdev/files/patch-src_FileSTL.cpp b/cad/meshdev/files/patch-src_FileSTL.cpp
new file mode 100644
index 000000000000..f4715e0ad9d8
--- /dev/null
+++ b/cad/meshdev/files/patch-src_FileSTL.cpp
@@ -0,0 +1,153 @@
+--- /dev/null 2012-02-06 16:11:28.000000000 +0100
++++ src/FileSTL.cpp 2012-02-06 16:12:28.000000000 +0100
+@@ -0,0 +1,150 @@
++/*-
++Copyright (C) 2012 Pietro Cerutti <gahr@gahr.ch>
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions
++are met:
++1. Redistributions of source code must retain the above copyright
++ notice, this list of conditions and the following disclaimer.
++2. Redistributions in binary form must reproduce the above copyright
++ notice, this list of conditions and the following disclaimer in the
++ documentation and/or other materials provided with the distribution.
++
++THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
++FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++SUCH DAMAGE.
++*/
++
++#include "FileSTL.h"
++#include <fstream>
++#include <iostream>
++#include <cstdio>
++
++//--
++//
++// ReadSTL
++//
++// --
++// Read a binary or ASCII STL file
++bool ReadSTL( Mesh& mesh, const std::string& file_name )
++{
++ std::ifstream file; // File to read
++ char head[7]; // File header
++ float coords[3]; // Store a coordinate
++ unsigned int nof_faces; // Number of faces (always multiple of 3)
++ unsigned int i, j;
++
++ /* Open file */
++ file.open(file_name.c_str(), std::ios::binary);
++
++ /* Test if file is open */
++ if (file.is_open() == false) {
++ return (false);
++ }
++
++ /* Read header */
++ file.read(head, 6);
++ head[6] = '\0';
++
++ /* Reposition at beginning of file */
++ file.seekg(0, std::ios_base::beg);
++
++ /* Initialize the mesh */
++ mesh.ClearAll();
++
++ if (strcmp(head, "solid ") == 0) {
++ /*
++ * Read ASCII STL
++ */
++
++ nof_faces= 0;
++
++ std::string line;
++
++ /* ignore first line */
++ std::getline(file, line);
++
++ /*
++ * Read the file line by line
++ */
++ while (std::getline(file, line)) {
++
++ /* skip description lines */
++
++ if (line.compare("outer loop") == 0) {
++ continue;
++ }
++ if (line.compare("endloop") == 0) {
++ continue;
++ }
++ if (line.compare("end facet") == 0) {
++ continue;
++ }
++ if (line.compare(0, 7, "endsolid")) {
++ break;
++ }
++
++ /* facet normal */
++ if (line.compare(0, 12, "facet normal") == 0) {
++ sscanf(line.c_str(), "facet normal %e %e %e", &coords[0], &coords[1], &coords[2]);
++ mesh.AddVertexNormal(Vector3d(coords[0], coords[1], coords[2]));
++ }
++
++ /* vertex */
++ if (line.compare(0, 6, "vertex") == 0) {
++ sscanf(line.c_str(), "vertex %e %e %e", &coords[0], &coords[1], &coords[2]);
++ mesh.AddVertex(Vector3d(coords[0], coords[1], coords[2]));
++
++ if (++nof_faces % 3) {
++ mesh.AddFace(Vector3i((int)nof_faces-1, (int)nof_faces-2, (int)nof_faces-3));
++ }
++ }
++ }
++
++
++ } else {
++ /*
++ * Read binary STL
++ */
++
++ /* skip first 80 bytes (header) */
++ file.seekg(80, std::ios_base::beg);
++
++ /* read number of triangles */
++ file.read((char *)&nof_faces, 4);
++
++ /*
++ * read the file triangle by triangle
++ */
++ for (i=0; i<nof_faces; i++) {
++
++ /* facet normal */
++ file.read((char *)&coords, 12);
++ mesh.AddVertexNormal(Vector3d(coords[0], coords[1], coords[2]));
++
++ /* vertices */
++ for (j=0; j<3; j++) {
++ file.read((char *)&coords, 12);
++ mesh.AddVertex(Vector3d(coords[0], coords[1], coords[2]));
++ }
++ mesh.AddFace(Vector3i((int)(i*3), (int)(i*3)+1, (int)(i*3)+2));
++
++ /* skip 2 bytes */
++ file.seekg(2, std::ios_base::cur);
++ }
++
++ }
++
++ // Close file
++ file.close();
++
++ return (true);
++}
diff --git a/cad/meshdev/files/patch-src_FileSTL.h b/cad/meshdev/files/patch-src_FileSTL.h
new file mode 100644
index 000000000000..39428860423e
--- /dev/null
+++ b/cad/meshdev/files/patch-src_FileSTL.h
@@ -0,0 +1,39 @@
+--- /dev/null 2012-02-06 16:11:28.000000000 +0100
++++ src/FileSTL.h 2012-02-06 16:12:28.000000000 +0100
+@@ -0,0 +1,36 @@
++/*-
++Copyright (C) 2012 Pietro Cerutti <gahr@gahr.ch>
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions
++are met:
++1. Redistributions of source code must retain the above copyright
++ notice, this list of conditions and the following disclaimer.
++2. Redistributions in binary form must reproduce the above copyright
++ notice, this list of conditions and the following disclaimer in the
++ documentation and/or other materials provided with the distribution.
++
++THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
++FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++SUCH DAMAGE.
++*/
++
++#ifndef _FILESTL_
++#define _FILESTL_
++
++#include "Mesh.h"
++#include <string>
++
++
++// Read a binary or ASCII STL file
++extern bool ReadSTL( Mesh& mesh, const std::string& file_name );
++
++#endif /* !_FILESTL_H */
diff --git a/cad/meshdev/files/patch-src_Mesh.cpp b/cad/meshdev/files/patch-src_Mesh.cpp
new file mode 100644
index 000000000000..2e439ccc81ac
--- /dev/null
+++ b/cad/meshdev/files/patch-src_Mesh.cpp
@@ -0,0 +1,34 @@
+--- src/Mesh.cpp.orig 2012-02-06 16:12:15.000000000 +0100
++++ src/Mesh.cpp 2012-02-06 16:14:59.000000000 +0100
+@@ -18,6 +18,7 @@
+ #include "Mesh.h"
+ #include "FileVrml1.h"
+ #include "FileVrml2.h"
++#include "FileSTL.h"
+ #include <fstream>
+ #include <iostream>
+
+@@ -173,6 +174,12 @@
+ {
+ file_format = INVENTOR_FILE;
+ }
++ // STL extension
++ else if( extension == "STL" || extension == "stl" )
++ {
++ file_format = STL_FILE;
++ }
++
+ // Other extension
+ else
+ {
+@@ -194,6 +201,10 @@
+ case VRML_2_FILE :
+ return ReadVrml2( *this, file_name );
+
++ // STL file
++ case STL_FILE:
++ return ReadSTL( *this, file_name );
++
+ // Other file
+ default :
+ // Unknown file format
diff --git a/cad/meshdev/files/patch-src_Mesh.h b/cad/meshdev/files/patch-src_Mesh.h
new file mode 100644
index 000000000000..ee1514f53d37
--- /dev/null
+++ b/cad/meshdev/files/patch-src_Mesh.h
@@ -0,0 +1,12 @@
+--- src/Mesh.h.orig 2012-02-06 16:12:01.000000000 +0100
++++ src/Mesh.h 2012-02-06 16:13:59.000000000 +0100
+@@ -33,7 +33,8 @@
+ UNKNOWN_FILE,
+ INVENTOR_FILE,
+ VRML_1_FILE,
+- VRML_2_FILE
++ VRML_2_FILE,
++ STL_FILE
+ };
+
+ //--
diff --git a/cad/meshdev/pkg-descr b/cad/meshdev/pkg-descr
new file mode 100644
index 000000000000..9196474c09da
--- /dev/null
+++ b/cad/meshdev/pkg-descr
@@ -0,0 +1,7 @@
+MeshDev is a mesh comparison software. It accepts two meshes as input and
+computes the geometrical deviation between the two meshes.
+It return numerical values and can optionaly generate visual results (with a
+pseudo-colored mesh corresponding to the measured deviation) in OpenInventor
+format.
+
+WWW: http://meshdev.sourceforge.net/