summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-04-28 21:36:56 (GMT)
committerMarius Kintel <marius@kintel.net>2011-04-28 21:36:56 (GMT)
commit2f740380dc407a51cff74273810104f9e21025fe (patch)
tree82d1e0bb079be1a42a445298608667ba810eb6ae
parentd24b3cc84d0701a5423925765e515db7df9614c5 (diff)
parenteb16c3ea5623f6d3745f8ea0ddba889e75e37bf1 (diff)
Merged with master
-rw-r--r--RELEASE_NOTES2
-rw-r--r--doc/TODO.txt12
-rw-r--r--doc/release-checklist.txt12
-rwxr-xr-xscripts/macosx-build-dependencies.sh4
-rwxr-xr-xscripts/publish-macosx.sh2
-rwxr-xr-xscripts/release-linux.sh6
-rw-r--r--src/openscad.cc12
-rw-r--r--src/primitives.cc117
8 files changed, 86 insertions, 81 deletions
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 352fa67..81bf603 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -1,4 +1,4 @@
-OpenSCAD 2011.XX
+OpenSCAD 2011.04
================
o Added hull() for convex hulls (2D object only)
diff --git a/doc/TODO.txt b/doc/TODO.txt
index 1d29fb1..7612d86 100644
--- a/doc/TODO.txt
+++ b/doc/TODO.txt
@@ -98,9 +98,15 @@ o Editor wishlist
in the source code in the 3D view
- Tabbed editor for designs including other files
- C-c/C-v should work on the focused widget, not always in the editor
-
+o Error reporting/debugging
+ - Provide better error messages when polygon ordering causes CGAL errors:
+ o Supply syntax highlighting of the exact polygon indices which are
+ reported to be wrong
+ o Provide some interaction for debug walk-through?
+ - Provide visual highlighting of geometry corresponding to code
+ -> could aid debugging a lot
o Computation
- - Run CGAL rendering in a backgroud thread
+ - Run CGAL rendering in a background thread
- Enable viewing/editing while rendering
- Progress: Call progresswidget more often to avoid app hanging for multiple
seconds (i.e. make cancel button more responsive)
@@ -163,6 +169,8 @@ o Misc
- Add 'lines' object type for non-solid 2d drawings
- Is there a reason why modules like echo, empty if, empty for loop returns an
empty AbstractNode instead of being ignored?
+ - Bug: Using the background operator (%) on the only object in a scene triggers a
+ CSG error: No top level object found
o Grammar
- dim->name -> dim->label
- A random(seed) function
diff --git a/doc/release-checklist.txt b/doc/release-checklist.txt
index d0e1174..45e84fb 100644
--- a/doc/release-checklist.txt
+++ b/doc/release-checklist.txt
@@ -12,7 +12,7 @@ o Tag release
git tag "openscad-2011.01"
o build source package
- git archive --format=tar openscad-2011.01 --prefix=openscad-2011.01/ | gzip > openscad-2011.01.tar.gz
+ git archive --format=tar openscad-2011.01 --prefix=openscad-2011.01/ | gzip > openscad-2011.01.src.tar.gz
o build binaries
Mac OS X
@@ -21,6 +21,8 @@ o build binaries
- release-linux.sh
Windows: FIXME 32 vs. 64 bit
+o FIXME: Run some tests
+
o Set back version: release-linux.sh, publish-macosx.sh, FIXME: Windows
o Upload
@@ -28,9 +30,5 @@ o Upload
Upload manually here: https://github.com/openscad/openscad/downloads
FIXME: Write a script
- - Google code
- - Get password from https://code.google.com/hosting/settings
- ./scripts/googlecode_upload.py -u kintel -w <passwd> -s "OpenSCAD 2011.11 Windows" -p openscad openscad-2011.01.win32.zip
- ./scripts/googlecode_upload.py -u kintel -w <passwd> -s "OpenSCAD 2011.11 Linux x86" -p openscad openscad-2011.01.linux-x86.tar.gz
- ./scripts/googlecode_upload.py -u kintel -w <passwd> -s "OpenSCAD 2011.11 Mac OS X" -p openscad openscad-2011.01.dmg
- ./scripts/googlecode_upload.py -u kintel -w <passwd> -s "OpenSCAD 2011.11 Source code" -p openscad openscad-2011.01.src.tar.gz
+o Update web page
+o Write email to mailing list
diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh
index 1ee670d..92552a2 100755
--- a/scripts/macosx-build-dependencies.sh
+++ b/scripts/macosx-build-dependencies.sh
@@ -46,7 +46,7 @@ build_gmp()
# 64-bit version
mkdir build-x86_64
cd build-x86_64
- ../configure --prefix=$DEPLOYDIR/x86_64 "CFLAGS=-mmacosx-version-min=10.5" LDFLAGS="-mmacosx-version-min=10.5" --enable-cxx
+ ../configure --prefix=$DEPLOYDIR/x86_64 "CFLAGS=-mmacosx-version-min=10.5 -arch x86_64" LDFLAGS="-mmacosx-version-min=10.5 -arch x86_64" ABI=64 --enable-cxx
make install
# merge
@@ -159,7 +159,7 @@ build_opencsg()
echo "Using basedir:" $BASEDIR
mkdir -p $SRCDIR $DEPLOYDIR
build_gmp 5.0.1
-build_mpfr 3.0.0
+build_mpfr 3.0.1
build_boost 1.46.1
build_cgal 3.7
build_glew 1.5.8
diff --git a/scripts/publish-macosx.sh b/scripts/publish-macosx.sh
index 11820df..6586525 100755
--- a/scripts/publish-macosx.sh
+++ b/scripts/publish-macosx.sh
@@ -1,7 +1,7 @@
#!/bin/sh
VERSION=`date "+%Y.%m.%d"`
-#VERSION=2010.05
+#VERSION=2011.04
# This is the same location as DEPLOYDIR in macosx-build-dependencies.sh
export MACOSX_DEPLOY_DIR=$PWD/../libraries/install
diff --git a/scripts/release-linux.sh b/scripts/release-linux.sh
index 8f532e0..e576faa 100755
--- a/scripts/release-linux.sh
+++ b/scripts/release-linux.sh
@@ -2,7 +2,7 @@
# WARNING: This script might only work with the authors setup...
VERSION=`date "+%Y.%m.%d"`
-#VERSION=2010.05
+#VERSION=2011.04
set -ex
@@ -30,8 +30,8 @@ gcc -o chrpath_linux scripts/chrpath_linux.c
./chrpath_linux -d release/lib/openscad/openscad
ldd openscad | sed -re 's,.* => ,,; s,[\t ].*,,;' -e '/Qt|boost/ { p; d; };' \
- -e '/lib(audio|CGAL|GLEW|opencsg|png)\.so/ { p; d; };' \
- -e 'd;' | xargs cp -vt release/lib/openscad/
+ -e '/lib(audio|CGAL|GLEW|opencsg|png|gmp|gmpxx|mpfr)\.so/ { p; d; };' \
+ -e 'd;' | xargs cp -vt release/lib/openscad/
strip release/lib/openscad/*
cat > release/install.sh << "EOT"
diff --git a/src/openscad.cc b/src/openscad.cc
index b37de12..979a68f 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -146,12 +146,12 @@ int main(int argc, char **argv)
desc.add_options()
("help,h", "help message")
("version,v", "print the version")
- ("s", po::value<string>(), "stl-file")
- ("o", po::value<string>(), "off-file")
- ("x", po::value<string>(), "dxf-file")
- ("d", po::value<string>(), "deps-file")
- ("m", po::value<string>(), "makefile")
- ("D", po::value<vector<string> >(), "var=val");
+ ("s,s", po::value<string>(), "stl-file")
+ ("o,o", po::value<string>(), "off-file")
+ ("x,x", po::value<string>(), "dxf-file")
+ ("d,d", po::value<string>(), "deps-file")
+ ("m,m", po::value<string>(), "makefile")
+ ("D,D", po::value<vector<string> >(), "var=val");
po::options_description hidden("Hidden options");
hidden.add_options()
diff --git a/src/primitives.cc b/src/primitives.cc
index 7232dc2..def90c9 100644
--- a/src/primitives.cc
+++ b/src/primitives.cc
@@ -258,6 +258,19 @@ int get_fragments_from_r(double r, double fn, double fs, double fa)
return (int)ceil(fmax(fmin(360.0 / fa, r*M_PI / fs), 5));
}
+struct point2d {
+ double x, y;
+};
+
+static void generate_circle(point2d *circle, double r, int fragments)
+{
+ for (int i=0; i<fragments; i++) {
+ double phi = (M_PI*2* (i + 0.5)) / fragments;
+ circle[i].x = r*cos(phi);
+ circle[i].y = r*sin(phi);
+ }
+}
+
PolySet *PrimitiveNode::render_polyset(render_mode_e, class PolySetRenderer *) const
{
PolySet *p = new PolySet();
@@ -318,69 +331,66 @@ PolySet *PrimitiveNode::render_polyset(render_mode_e, class PolySetRenderer *) c
if (this->type == SPHERE && this->r1 > 0)
{
- struct point2d {
- double x, y;
- };
-
struct ring_s {
- int fragments;
point2d *points;
- double r, z;
+ double z;
};
- int rings = get_fragments_from_r(this->r1, this->fn, this->fs, this->fa);
+ int fragments = get_fragments_from_r(r1, fn, fs, fa);
+ int rings = fragments/2;
+// Uncomment the following three lines to enable experimental sphere tesselation
+// if (rings % 2 == 0) rings++; // To ensure that the middle ring is at phi == 0 degrees
+
ring_s *ring = new ring_s[rings];
+// double offset = 0.5 * ((fragments / 2) % 2);
for (int i = 0; i < rings; i++) {
+// double phi = (M_PI * (i + offset)) / (fragments/2);
double phi = (M_PI * (i + 0.5)) / rings;
- ring[i].r = this->r1 * sin(phi);
- ring[i].z = this->r1 * cos(phi);
- ring[i].fragments = get_fragments_from_r(ring[i].r, this->fn, this->fs, this->fa);
- ring[i].points = new point2d[ring[i].fragments];
- for (int j = 0; j < ring[i].fragments; j++) {
- phi = (M_PI*2*j) / ring[i].fragments;
- ring[i].points[j].x = ring[i].r * cos(phi);
- ring[i].points[j].y = ring[i].r * sin(phi);
- }
+ double r = r1 * sin(phi);
+ ring[i].z = r1 * cos(phi);
+ ring[i].points = new point2d[fragments];
+ generate_circle(ring[i].points, r, fragments);
}
p->append_poly();
- for (int i = 0; i < ring[0].fragments; i++)
+ for (int i = 0; i < fragments; i++)
p->append_vertex(ring[0].points[i].x, ring[0].points[i].y, ring[0].z);
for (int i = 0; i < rings-1; i++) {
ring_s *r1 = &ring[i];
ring_s *r2 = &ring[i+1];
int r1i = 0, r2i = 0;
- while (r1i < r1->fragments || r2i < r2->fragments)
+ while (r1i < fragments || r2i < fragments)
{
- if (r1i >= r1->fragments)
+ if (r1i >= fragments)
goto sphere_next_r2;
- if (r2i >= r2->fragments)
+ if (r2i >= fragments)
goto sphere_next_r1;
- if ((double)r1i / r1->fragments < (double)r2i / r2->fragments)
+ if ((double)r1i / fragments <
+ (double)r2i / fragments)
{
sphere_next_r1:
p->append_poly();
- int r1j = (r1i+1) % r1->fragments;
+ int r1j = (r1i+1) % fragments;
p->insert_vertex(r1->points[r1i].x, r1->points[r1i].y, r1->z);
p->insert_vertex(r1->points[r1j].x, r1->points[r1j].y, r1->z);
- p->insert_vertex(r2->points[r2i % r2->fragments].x, r2->points[r2i % r2->fragments].y, r2->z);
+ p->insert_vertex(r2->points[r2i % fragments].x, r2->points[r2i % fragments].y, r2->z);
r1i++;
} else {
sphere_next_r2:
p->append_poly();
- int r2j = (r2i+1) % r2->fragments;
+ int r2j = (r2i+1) % fragments;
p->append_vertex(r2->points[r2i].x, r2->points[r2i].y, r2->z);
p->append_vertex(r2->points[r2j].x, r2->points[r2j].y, r2->z);
- p->append_vertex(r1->points[r1i % r1->fragments].x, r1->points[r1i % r1->fragments].y, r1->z);
+ p->append_vertex(r1->points[r1i % fragments].x, r1->points[r1i % fragments].y, r1->z);
r2i++;
}
}
}
p->append_poly();
- for (int i = 0; i < ring[rings-1].fragments; i++)
+ for (int i = 0; i < fragments; i++)
p->insert_vertex(ring[rings-1].points[i].x, ring[rings-1].points[i].y, ring[rings-1].z);
delete[] ring;
@@ -400,44 +410,33 @@ sphere_next_r2:
z2 = this->h;
}
- struct point2d {
- double x, y;
- };
-
point2d *circle1 = new point2d[fragments];
point2d *circle2 = new point2d[fragments];
- for (int i=0; i<fragments; i++) {
- double phi = (M_PI*2*i) / fragments;
- if (this->r1 > 0) {
- circle1[i].x = this->r1*cos(phi);
- circle1[i].y = this->r1*sin(phi);
- } else {
- circle1[i].x = 0;
- circle1[i].y = 0;
- }
- if (this->r2 > 0) {
- circle2[i].x = this->r2*cos(phi);
- circle2[i].y = this->r2*sin(phi);
- } else {
- circle2[i].x = 0;
- circle2[i].y = 0;
- }
- }
+ generate_circle(circle1, r1, fragments);
+ generate_circle(circle2, r2, fragments);
for (int i=0; i<fragments; i++) {
int j = (i+1) % fragments;
- if (this->r1 > 0) {
+ if (r1 == r2) {
p->append_poly();
p->insert_vertex(circle1[i].x, circle1[i].y, z1);
p->insert_vertex(circle2[i].x, circle2[i].y, z2);
- p->insert_vertex(circle1[j].x, circle1[j].y, z1);
- }
- if (this->r2 > 0) {
- p->append_poly();
- p->insert_vertex(circle2[i].x, circle2[i].y, z2);
p->insert_vertex(circle2[j].x, circle2[j].y, z2);
p->insert_vertex(circle1[j].x, circle1[j].y, z1);
+ } else {
+ if (r1 > 0) {
+ p->append_poly();
+ p->insert_vertex(circle1[i].x, circle1[i].y, z1);
+ p->insert_vertex(circle2[i].x, circle2[i].y, z2);
+ p->insert_vertex(circle1[j].x, circle1[j].y, z1);
+ }
+ if (r2 > 0) {
+ p->append_poly();
+ p->insert_vertex(circle2[i].x, circle2[i].y, z2);
+ p->insert_vertex(circle2[j].x, circle2[j].y, z2);
+ p->insert_vertex(circle1[j].x, circle1[j].y, z1);
+ }
}
}
@@ -460,10 +459,10 @@ sphere_next_r2:
if (this->type == POLYHEDRON)
{
p->convexity = this->convexity;
- for (int i=0; i<this->triangles.vec.size(); i++)
+ for (size_t i=0; i<this->triangles.vec.size(); i++)
{
p->append_poly();
- for (int j=0; j<this->triangles.vec[i]->vec.size(); j++) {
+ for (size_t j=0; j<this->triangles.vec[i]->vec.size(); j++) {
int pt = this->triangles.vec[i]->vec[j]->num;
if (pt < this->points.vec.size()) {
double px, py, pz;
@@ -513,7 +512,7 @@ sphere_next_r2:
{
DxfData dd;
- for (int i=0; i<this->points.vec.size(); i++) {
+ for (size_t i=0; i<this->points.vec.size(); i++) {
double x,y;
if (!this->points.vec[i]->getv2(x, y)) {
PRINTF("ERROR: Unable to convert point at index %d to a vec2 of numbers", i);
@@ -526,7 +525,7 @@ sphere_next_r2:
if (this->paths.vec.size() == 0)
{
dd.paths.append(DxfData::Path());
- for (int i=0; i<this->points.vec.size(); i++) {
+ for (size_t i=0; i<this->points.vec.size(); i++) {
assert(i < dd.points.size()); // FIXME: Not needed, but this used to be an 'if'
DxfData::Point *p = &dd.points[i];
dd.paths.last().points.append(p);
@@ -538,10 +537,10 @@ sphere_next_r2:
}
else
{
- for (int i=0; i<this->paths.vec.size(); i++)
+ for (size_t i=0; i<this->paths.vec.size(); i++)
{
dd.paths.append(DxfData::Path());
- for (int j=0; j<this->paths.vec[i]->vec.size(); j++) {
+ for (size_t j=0; j<this->paths.vec[i]->vec.size(); j++) {
int idx = this->paths.vec[i]->vec[j]->num;
if (idx < dd.points.size()) {
DxfData::Point *p = &dd.points[idx];
contact: Jan Huwald // Impressum