From 5eed043d5330b4283a27b438f0c6f95a9e08504a Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Tue, 22 Mar 2011 19:50:59 +0000 Subject: Optimised cylinder generation. When the sides are vertical we can use 4 sided polygons instead of triangles to define the sides, this reduces the facet count for the sides of the cylinder by half. diff --git a/src/primitives.cc b/src/primitives.cc index d0cd1b5..a971683 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -377,17 +377,25 @@ sphere_next_r2: for (int i=0; i 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 (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); + } } } -- cgit v0.10.1 From 9357469cce78a60cb988d904c475eb8b38928827 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Tue, 22 Mar 2011 20:38:48 +0000 Subject: Optimised sphere generation. Simply use the same number of fragments for each ring, and use half the number of fragments to determine the number of rings This results in a sphere that has the same projection when viewed from above or from the front. diff --git a/src/primitives.cc b/src/primitives.cc index a971683..f618b44 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -273,65 +273,64 @@ PolySet *PrimitiveNode::render_polyset(render_mode_e) const }; struct ring_s { - int fragments; point2d *points; - double r, z; + double z; }; - int rings = get_fragments_from_r(r1, fn, fs, fa); + int fragments = get_fragments_from_r(r1, fn, fs, fa); + int rings = fragments/2; ring_s *ring = new ring_s[rings]; for (int i = 0; i < rings; i++) { double phi = (M_PI * (i + 0.5)) / rings; - ring[i].r = r1 * sin(phi); + double r = r1 * sin(phi); ring[i].z = r1 * cos(phi); - ring[i].fragments = get_fragments_from_r(ring[i].r, fn, fs, 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); + ring[i].points = new point2d[fragments]; + for (int j = 0; j < fragments; j++) { + phi = (M_PI*2*j) / fragments; + ring[i].points[j].x = r * cos(phi); + ring[i].points[j].y = r * sin(phi); } } 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; -- cgit v0.10.1 From 9d94eaddc86ec262c0243571d8847c8d2f649fc4 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Thu, 7 Apr 2011 23:34:57 +0100 Subject: Fixed for when rings <= 0. diff --git a/src/primitives.cc b/src/primitives.cc index f618b44..cdbb18e 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -279,6 +279,9 @@ PolySet *PrimitiveNode::render_polyset(render_mode_e) const int fragments = get_fragments_from_r(r1, fn, fs, fa); int rings = fragments/2; + if(rings<=0) + rings=1; + ring_s *ring = new ring_s[rings]; for (int i = 0; i < rings; i++) { -- cgit v0.10.1 From 4853111f828fbbb9445fbf9d72f1e2c73930611f Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 12 Apr 2011 20:43:57 +0200 Subject: Added bug diff --git a/doc/TODO.txt b/doc/TODO.txt index cca4a2a..88257cb 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -104,7 +104,7 @@ o Editor wishlist - C-c/C-v should work on the focused widget, not always in the editor 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) @@ -167,6 +167,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 -- cgit v0.10.1 From df5b74216918aecb768463bf7c9ec0e26fbd4525 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 12 Apr 2011 21:51:45 +0200 Subject: bugfix: Pass short options to boost program_options diff --git a/src/openscad.cc b/src/openscad.cc index aa0188c..4b6cc1b 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -140,12 +140,12 @@ int main(int argc, char **argv) desc.add_options() ("help,h", "help message") ("version,v", "print the version") - ("s", po::value(), "stl-file") - ("o", po::value(), "off-file") - ("x", po::value(), "dxf-file") - ("d", po::value(), "deps-file") - ("m", po::value(), "makefile") - ("D", po::value >(), "var=val"); + (",s", po::value(), "stl-file") + (",o", po::value(), "off-file") + (",x", po::value(), "dxf-file") + (",d", po::value(), "deps-file") + (",m", po::value(), "makefile") + (",D", po::value >(), "var=val"); po::options_description hidden("Hidden options"); hidden.add_options() -- cgit v0.10.1 From 0545f0ef8100d1efc588e8fb97ae75d9dee8ca8f Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 12 Apr 2011 22:37:36 +0200 Subject: Run some tests diff --git a/doc/release-checklist.txt b/doc/release-checklist.txt index d0e1174..419b899 100644 --- a/doc/release-checklist.txt +++ b/doc/release-checklist.txt @@ -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 -- cgit v0.10.1 From c8dd96b76f672d5f99ceb63db2155447bbaa868b Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 12 Apr 2011 22:37:49 +0200 Subject: Must specify both long and short options diff --git a/src/openscad.cc b/src/openscad.cc index 4b6cc1b..bf22246 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -140,12 +140,12 @@ int main(int argc, char **argv) desc.add_options() ("help,h", "help message") ("version,v", "print the version") - (",s", po::value(), "stl-file") - (",o", po::value(), "off-file") - (",x", po::value(), "dxf-file") - (",d", po::value(), "deps-file") - (",m", po::value(), "makefile") - (",D", po::value >(), "var=val"); + ("s,s", po::value(), "stl-file") + ("o,o", po::value(), "off-file") + ("x,x", po::value(), "dxf-file") + ("d,d", po::value(), "deps-file") + ("m,m", po::value(), "makefile") + ("D,D", po::value >(), "var=val"); po::options_description hidden("Hidden options"); hidden.add_options() -- cgit v0.10.1 From 8c95ac44629e699c842a883c79d0833c5b83475c Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 13 Apr 2011 14:30:55 +0200 Subject: Changed circle calculation to match sphere tessellation; makes example022 look better diff --git a/src/primitives.cc b/src/primitives.cc index 1e411e0..0f82c1b 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -219,6 +219,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 0) { - struct point2d { - double x, y; - }; - struct ring_s { point2d *points; double z; @@ -290,21 +299,19 @@ PolySet *PrimitiveNode::render_polyset(render_mode_e) const int fragments = get_fragments_from_r(r1, fn, fs, fa); int rings = fragments/2; - if(rings<=0) - rings=1; +// 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; double r = r1 * sin(phi); ring[i].z = r1 * cos(phi); ring[i].points = new point2d[fragments]; - for (int j = 0; j < fragments; j++) { - phi = (M_PI*2*j) / fragments; - ring[i].points[j].x = r * cos(phi); - ring[i].points[j].y = r * sin(phi); - } + generate_circle(ring[i].points, r, fragments); } p->append_poly(); @@ -363,30 +370,11 @@ sphere_next_r2: z2 = h; } - struct point2d { - double x, y; - }; - point2d *circle1 = new point2d[fragments]; point2d *circle2 = new point2d[fragments]; - for (int i=0; i 0) { - circle1[i].x = r1*cos(phi); - circle1[i].y = r1*sin(phi); - } else { - circle1[i].x = 0; - circle1[i].y = 0; - } - if (r2 > 0) { - circle2[i].x = r2*cos(phi); - circle2[i].y = 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 Date: Wed, 13 Apr 2011 20:20:53 +0200 Subject: package mpfr and gmp with binaries - thanks Giles diff --git a/scripts/release-linux.sh b/scripts/release-linux.sh index 8f532e0..aa27935 100755 --- a/scripts/release-linux.sh +++ b/scripts/release-linux.sh @@ -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" -- cgit v0.10.1 From 5247962554be539b8585844e62377a6490b38d2b Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Mon, 18 Apr 2011 13:07:54 +0200 Subject: Added some notes/ideas on visual debugging inspired by Stuart Young diff --git a/doc/TODO.txt b/doc/TODO.txt index 88257cb..45660de 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -102,7 +102,13 @@ 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 background thread - Enable viewing/editing while rendering -- cgit v0.10.1 From 1f51e279d80f5307c9dd0ff511d48f4441c73f4b Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 19 Apr 2011 04:54:56 +0200 Subject: bugfix: 64-bit build of gmp was broken under Leopard, bumped to mpfr 3.0.1 diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index f5a44d0..b03b2b2 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 @@ -158,7 +158,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 -- cgit v0.10.1 From 45e80489f8ebc36f56bae3597dceef609318b60c Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 26 Apr 2011 20:58:37 -0400 Subject: Updated version to 2011.04 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/scripts/publish-macosx.sh b/scripts/publish-macosx.sh index 11820df..eb15418 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=`date "+%Y.%m.%d"` +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 aa27935..b6f8d62 100755 --- a/scripts/release-linux.sh +++ b/scripts/release-linux.sh @@ -1,8 +1,8 @@ #!/bin/bash # WARNING: This script might only work with the authors setup... -VERSION=`date "+%Y.%m.%d"` -#VERSION=2010.05 +#VERSION=`date "+%Y.%m.%d"` +VERSION=2011.04 set -ex -- cgit v0.10.1 From 6b14e9a169ce6263dfac13b1253febf9f652d2d4 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Thu, 28 Apr 2011 09:53:58 -0400 Subject: Minor adjustments diff --git a/doc/release-checklist.txt b/doc/release-checklist.txt index 419b899..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 @@ -30,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 -s "OpenSCAD 2011.11 Windows" -p openscad openscad-2011.01.win32.zip - ./scripts/googlecode_upload.py -u kintel -w -s "OpenSCAD 2011.11 Linux x86" -p openscad openscad-2011.01.linux-x86.tar.gz - ./scripts/googlecode_upload.py -u kintel -w -s "OpenSCAD 2011.11 Mac OS X" -p openscad openscad-2011.01.dmg - ./scripts/googlecode_upload.py -u kintel -w -s "OpenSCAD 2011.11 Source code" -p openscad openscad-2011.01.src.tar.gz +o Update web page +o Write email to mailing list -- cgit v0.10.1 From eb16c3ea5623f6d3745f8ea0ddba889e75e37bf1 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Thu, 28 Apr 2011 10:58:19 -0400 Subject: reset version to using date-tag diff --git a/scripts/publish-macosx.sh b/scripts/publish-macosx.sh index eb15418..6586525 100755 --- a/scripts/publish-macosx.sh +++ b/scripts/publish-macosx.sh @@ -1,7 +1,7 @@ #!/bin/sh -#VERSION=`date "+%Y.%m.%d"` -VERSION=2011.04 +VERSION=`date "+%Y.%m.%d"` +#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 b6f8d62..e576faa 100755 --- a/scripts/release-linux.sh +++ b/scripts/release-linux.sh @@ -1,8 +1,8 @@ #!/bin/bash # WARNING: This script might only work with the authors setup... -#VERSION=`date "+%Y.%m.%d"` -VERSION=2011.04 +VERSION=`date "+%Y.%m.%d"` +#VERSION=2011.04 set -ex -- cgit v0.10.1