mirror of https://github.com/vitalif/openscad
Merge branch 'master' of github.com:openscad/openscad
commit
ff02f14308
73
README.md
73
README.md
|
@ -88,24 +88,23 @@ libraries from aptitude. If you're using Mac, or an older Linux/BSD, there
|
|||
are build scripts that download and compile the libraries from source.
|
||||
Follow the instructions for the platform you're compiling on below.
|
||||
|
||||
* [Qt4 (4.4 - 5.3)](http://www.qt.nokia.com/)
|
||||
* [QScintilla2 (2.7)](http://www.riverbankcomputing.co.uk/software/qscintilla/)
|
||||
* [CGAL (3.6 - 4.4)](http://www.cgal.org/)
|
||||
* [Qt4 (4.4 - 5.4)](http://www.qt.nokia.com/)
|
||||
* [QScintilla2 (2.7 - 2.8)](http://www.riverbankcomputing.co.uk/software/qscintilla/)
|
||||
* [CGAL (3.6 - 4.5)](http://www.cgal.org/)
|
||||
* [GMP (5.x)](http://www.gmplib.org/)
|
||||
* [MPFR (3.x)](http://www.mpfr.org/)
|
||||
* [cmake (2.8, required by CGAL and the test framework)](http://www.cmake.org/)
|
||||
* [boost (1.35 - 1.55)](http://www.boost.org/)
|
||||
* [cmake (2.8 - 3.0, required by CGAL and the test framework)](http://www.cmake.org/)
|
||||
* [boost (1.35 - 1.57)](http://www.boost.org/)
|
||||
* [OpenCSG (1.3.2 ->)](http://www.opencsg.org/)
|
||||
* [GLEW (1.5.4 ->)](http://glew.sourceforge.net/)
|
||||
* [Eigen (3.x)](http://eigen.tuxfamily.org/)
|
||||
* [glib2 (2.x)](https://developer.gnome.org/glib/)
|
||||
* [fontconfig (2.10)](http://fontconfig.org/)
|
||||
* [freetype2 (2.4)](http://freetype.org/)
|
||||
* [harfbuzz (0.9.19)](http://harfbuzz.org/)
|
||||
* [GCC C++ Compiler (4.2 ->)](http://gcc.gnu.org/)
|
||||
* [Bison (2.4)](http://www.gnu.org/software/bison/)
|
||||
* [Flex (2.5.35)](http://flex.sourceforge.net/)
|
||||
* [pkg-config (0.26)](http://www.freedesktop.org/wiki/Software/pkg-config/)
|
||||
* [fontconfig (2.10 -> )](http://fontconfig.org/)
|
||||
* [freetype2 (2.4 -> )](http://freetype.org/)
|
||||
* [harfbuzz (0.9.19 -> )](http://harfbuzz.org/)
|
||||
* [Bison (2.4 -> )](http://www.gnu.org/software/bison/)
|
||||
* [Flex (2.5.35 -> )](http://flex.sourceforge.net/)
|
||||
* [pkg-config (0.26 -> )](http://www.freedesktop.org/wiki/Software/pkg-config/)
|
||||
|
||||
### Getting the source code
|
||||
|
||||
|
@ -123,29 +122,41 @@ To pull the MCAD library (http://reprap.org/wiki/MCAD), do the following:
|
|||
### Building for Mac OS X
|
||||
|
||||
Prerequisites:
|
||||
* XCode, including XCode command-line tools (install from XCode Preferences).
|
||||
|
||||
Prerequisites that can be installed through MacPorts/homebrew:
|
||||
* [CMake](http://cmake.org/)
|
||||
* [automake](http://www.gnu.org/software/automake/)
|
||||
* [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/)
|
||||
* [libtool](https://www.gnu.org/software/libtool/)
|
||||
* XCode, including XCode command-line tools.
|
||||
|
||||
Then after you've cloned this git repository, run the script that sets up the
|
||||
environment variables.
|
||||
Install Dependencies:
|
||||
|
||||
source setenv_mac-qt5.sh
|
||||
Run the script that sets up the environment variables:
|
||||
```source setenv_mac-qt5.sh```
|
||||
|
||||
Then run the script to compile all the prerequisite libraries above:
|
||||
Then run the script to compile all the dependencies:
|
||||
```./scripts/macosx-build-dependencies.sh```
|
||||
|
||||
./scripts/macosx-build-dependencies.sh
|
||||
|
||||
You can also install the prerequisites using
|
||||
[MacPorts](http://www.macports.org). Unfortunately,
|
||||
[brew](http://mxcl.github.com/homebrew/) doesn't yet support CGAL and
|
||||
OpenCSG.
|
||||
After building dependencies, follow the instructions in the *Compilation* section.
|
||||
|
||||
For the adventurous, it might be possible to build OpenSCAD using _MacPorts_ or _Homebrew_. The main challenge is that both these systems have partially broken libraries, but that tends to change from time to time.
|
||||
|
||||
1. **MacPorts** (assumes [MacPorts](http://macports.org) is already installed)
|
||||
|
||||
NB! MacPorts currently doesn't support Qt5 very well, so using Qt4
|
||||
is the only working option at the moment. However, MacPorts' Qt4
|
||||
has a broken ```moc``` command, causing OpenSCAD compilation to
|
||||
break. This may be fixed in MacPorts by the time you read this.
|
||||
|
||||
```sudo port install opencsg qscintilla boost cgal pkgconfig eigen3 harfbuzz fontconfig```
|
||||
|
||||
1. **Homebrew** (assumes [Homebrew](http://brew.sh)) is already installed)
|
||||
|
||||
NB! Homebrew's ```qscintilla2``` component doesn't support Qt5, so using Qt4 is currently necessary.
|
||||
However, Homebrew's Qt4 has a broken ```moc``` command, causing OpenSCAD compilation to
|
||||
break. This may be fixed in Homebrew by the time you read this.
|
||||
NB! Homebrew's ```harfbuzz``` package requires X11, so you may have to install an X11 server.
|
||||
NB! Homebrew doesnt have an OpenCSG package
|
||||
|
||||
```brew install cgal qscintilla2 eigen harfbuzz```
|
||||
|
||||
After that, follow the Compilation instructions below.
|
||||
|
||||
### Building for Linux/BSD
|
||||
|
||||
|
@ -220,9 +231,9 @@ For a 64-bit Windows cross-build, replace 32 with 64 in the above instructions.
|
|||
|
||||
### Compilation
|
||||
|
||||
First, run 'qmake openscad.pro' from Qt4 to generate a Makefile. On some systems
|
||||
you need to run 'qmake4', 'qmake-qt4' or something alike to run the qt4 version
|
||||
of the tool.
|
||||
First, run 'qmake openscad.pro' from Qt4 to generate a Makefile.
|
||||
|
||||
On some systems, depending on which version(s) of Qt you have installed, you may need to specify which version you want to use, e.g. by running 'qmake4', 'qmake-qt4' or something alike.
|
||||
|
||||
Then run make. Finally you might run 'make install' as root or simply copy the
|
||||
'openscad' binary (OpenSCAD.app on Mac OS X) to the bin directory of your choice.
|
||||
|
|
|
@ -25,9 +25,11 @@ static void stdFree(void* userData, void* ptr) {
|
|||
|
||||
This function should be robust wrt. malformed input.
|
||||
|
||||
It will only use existing vertices and is guaranteed use all
|
||||
existing vertices, i.e. it will maintain connectivity if the input
|
||||
polygon is part of a polygon mesh.
|
||||
It will only use existing vertices and is guaranteed to maintain
|
||||
connectivity if the input polygon is part of a polygon mesh.
|
||||
|
||||
One requirement: The input vertices must be distinct
|
||||
(i.e. duplicated must resolve to the same index).
|
||||
|
||||
Returns true on error, false on success.
|
||||
*/
|
||||
|
@ -38,12 +40,39 @@ bool GeometryUtils::tessellatePolygonWithHoles(const IndexedPolygons &polygons,
|
|||
// No polygon. FIXME: Will this ever happen or can we assert here?
|
||||
if (polygons.faces.empty()) return false;
|
||||
|
||||
if (polygons.faces.size() == 1 && polygons.faces[0].size() == 3) {
|
||||
// Remove consecutive equal vertices, as well as null ears
|
||||
std::vector<IndexedFace> faces = polygons.faces;
|
||||
BOOST_FOREACH(IndexedFace &face, faces) {
|
||||
int i=0;
|
||||
while (i < face.size()) {
|
||||
if (face[i] == face[(i+1)%face.size()]) { // Two consecutively equal indices
|
||||
face.erase(face.begin()+i);
|
||||
}
|
||||
else if (face[i] == face[(i+2)%face.size()]) { // Null ear
|
||||
face.erase(face.begin() + (i+1)%face.size());
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// First polygon has < 3 points - no output
|
||||
if (faces[0].size() < 3) return false;
|
||||
// Remove collapsed holes
|
||||
for (int i=1;i<faces.size();i++) {
|
||||
if (faces[i].size() < 3) {
|
||||
faces.erase(faces.begin() + i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
if (faces.size() == 1 && faces[0].size() == 3) {
|
||||
// Input polygon has 3 points. shortcut tessellation.
|
||||
triangles.push_back(IndexedTriangle(polygons.faces[0][0], polygons.faces[0][1], polygons.faces[0][2]));
|
||||
triangles.push_back(IndexedTriangle(faces[0][0], faces[0][1], faces[0][2]));
|
||||
return false;
|
||||
}
|
||||
|
||||
const Vector3f *verts = &polygons.vertices.front();
|
||||
TESSreal *normalvec = NULL;
|
||||
TESSreal passednormal[3];
|
||||
if (normal) {
|
||||
|
@ -68,8 +97,7 @@ bool GeometryUtils::tessellatePolygonWithHoles(const IndexedPolygons &polygons,
|
|||
// Since libtess2's indices is based on the running number of points added, we need to map back
|
||||
// to our indices. allindices does the mapping.
|
||||
std::vector<int> allindices;
|
||||
BOOST_FOREACH(const IndexedFace &face, polygons.faces) {
|
||||
const Vector3f *verts = &polygons.vertices.front();
|
||||
BOOST_FOREACH(const IndexedFace &face, faces) {
|
||||
contour.clear();
|
||||
BOOST_FOREACH(int idx, face) {
|
||||
const Vector3f &v = verts[idx];
|
||||
|
@ -99,7 +127,7 @@ bool GeometryUtils::tessellatePolygonWithHoles(const IndexedPolygons &polygons,
|
|||
|
||||
FIXME: This currently only works for polygons without holes.
|
||||
*/
|
||||
if (polygons.faces.size() == 1) { // Only works for polygons without holes
|
||||
if (faces.size() == 1) { // Only works for polygons without holes
|
||||
|
||||
/*
|
||||
Algorithm:
|
||||
|
@ -107,7 +135,6 @@ bool GeometryUtils::tessellatePolygonWithHoles(const IndexedPolygons &polygons,
|
|||
B) Locate all unused vertices
|
||||
C) For each unused vertex, create a triangle connecting it to the existing mesh
|
||||
*/
|
||||
const IndexedFace &face = polygons.faces.front();
|
||||
int inputSize = allindices.size(); // inputSize is number of points added to libtess2
|
||||
std::vector<int> vflags(inputSize); // Inits with 0's
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
translate([0,10,0]) difference() {
|
||||
cube(10, center=true);
|
||||
translate([6,5.5,0]) cube(11, center=true);
|
||||
translate([6,-5.500000000088,0]) cube(11, center=true);
|
||||
}
|
|
@ -1231,8 +1231,7 @@ list(APPEND BUGS_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue13.scad
|
|||
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1105.scad
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1105b.scad
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1105c.scad
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1105d.scad
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1165.scad)
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1105d.scad)
|
||||
list(APPEND EXPORT3D_TEST_FILES ${BUGS_FILES})
|
||||
list(REMOVE_ITEM EXPORT3D_TEST_FILES
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue899.scad
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
Loading…
Reference in New Issue