discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

intersecting with an hyperbola

NH
nop head
Thu, Dec 24, 2015 1:51 PM

Simply cut and paste it from the email. There is no line 38, so I think you
cut one too many lines.

On 24 December 2015 at 12:57, Kenneth Sloan kennethrsloan@gmail.com wrote:

Looks nice.  So…I tried to copy it to play with it (and understand it).

I get:

ERROR: Parser error in line 38: syntax error
ERROR: Conmpilation failed!

Presumably, that’s because I’m behind on my updates.
What version do I need, please?

--
Kenneth Sloan
KennethRSloan@gmail.com
Vision is the art of seeing what is invisible to others.

On Dec 24, 2015, at 04:01 , nop head nop.head@gmail.com wrote:

Here is a version that finally works.

<hyperbola.png>

xmin = -1;
xmax = 1;
ymin = -1;
ymax = 1;
step = 0.05;
zmin = min(xmin *ymax, xmax * ymin);

xpoints = floor((xmax - xmin) / step) + 1;
ypoints = floor((ymax - ymin) / step) + 1;
function index(x,y) = x * ypoints + y + 2;
function x(i) = xmin + i * step;
function y(i) = ymin + i * step;

points = concat([[xmin, ymin, zmin]],
[[xmax, ymax, zmin]],
[for(i = [0 : xpoints - 1]) for(j = [0 : ypoints - 1]) [x(i),
y(j), x(i) * y(j)]]);

function flatten(l) = [for(a = l) for (b = a) b];

base = concat(
[[1, 0, index(xpoints - 1, 0)]],
[[0, 1, index(0, ypoints - 1)]],
[for(i = [0 : xpoints - 2]) [0, index(i, 0), index(i + 1, 0)]],
[for(j = [0 : ypoints - 2]) [0, index(0, j + 1), index(0, j)]],
[for(i = [0 : xpoints - 2]) [1, index(i + 1, ypoints - 1),
index(i, ypoints - 1)]],
[for(j = [0 : ypoints - 2]) [1, index(xpoints - 1, j),
index(xpoints - 1, j + 1)]]
);

faces = flatten([for(i = [0 : xpoints - 2]) for(j = [0 : ypoints - 2])
[[index(i,j), index(i, j + 1), index(i + 1, j + 1)],
[index(i + 1, j + 1), index(i + 1, j ), index(i, j)]]
]);

difference() {
sphere(r= 0.5, $fn=80);
polyhedron(points, concat(base, faces), convexity = 2);
}

My stupid mistake was flattening the base list when it didn't need to be.
The result was some faces with multiple triangles instead of single
triangle per face. Looks like cgal can't handle that but the rest of the
system can. The STL file it exported was correct..

On 24 December 2015 at 07:45, Mekko serve@perdix.org wrote:

LOL. Actually, I'm not the potato chip guy - I'm just trying to cut a
sphere
in half with an hyperbola and getting a potato chip instead.

Hopefully the true Potato Chip Guy is reading this thread though!

--
View this message in context:
http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15313.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Simply cut and paste it from the email. There is no line 38, so I think you cut one too many lines. On 24 December 2015 at 12:57, Kenneth Sloan <kennethrsloan@gmail.com> wrote: > Looks nice. So…I tried to copy it to play with it (and understand it). > > I get: > > ERROR: Parser error in line 38: syntax error > ERROR: Conmpilation failed! > > Presumably, that’s because I’m behind on my updates. > What version do I need, please? > > -- > Kenneth Sloan > KennethRSloan@gmail.com > Vision is the art of seeing what is invisible to others. > > > > > On Dec 24, 2015, at 04:01 , nop head <nop.head@gmail.com> wrote: > > Here is a version that finally works. > > <hyperbola.png> > ​ > xmin = -1; > xmax = 1; > ymin = -1; > ymax = 1; > step = 0.05; > zmin = min(xmin *ymax, xmax * ymin); > > xpoints = floor((xmax - xmin) / step) + 1; > ypoints = floor((ymax - ymin) / step) + 1; > function index(x,y) = x * ypoints + y + 2; > function x(i) = xmin + i * step; > function y(i) = ymin + i * step; > > points = concat([[xmin, ymin, zmin]], > [[xmax, ymax, zmin]], > [for(i = [0 : xpoints - 1]) for(j = [0 : ypoints - 1]) [x(i), > y(j), x(i) * y(j)]]); > > function flatten(l) = [for(a = l) for (b = a) b]; > > base = concat( > [[1, 0, index(xpoints - 1, 0)]], > [[0, 1, index(0, ypoints - 1)]], > [for(i = [0 : xpoints - 2]) [0, index(i, 0), index(i + 1, 0)]], > [for(j = [0 : ypoints - 2]) [0, index(0, j + 1), index(0, j)]], > [for(i = [0 : xpoints - 2]) [1, index(i + 1, ypoints - 1), > index(i, ypoints - 1)]], > [for(j = [0 : ypoints - 2]) [1, index(xpoints - 1, j), > index(xpoints - 1, j + 1)]] > ); > > faces = flatten([for(i = [0 : xpoints - 2]) for(j = [0 : ypoints - 2]) > [[index(i,j), index(i, j + 1), index(i + 1, j + 1)], > [index(i + 1, j + 1), index(i + 1, j ), index(i, j)]] > ]); > > difference() { > sphere(r= 0.5, $fn=80); > polyhedron(points, concat(base, faces), convexity = 2); > } > ​ > > My stupid mistake was flattening the base list when it didn't need to be. > The result was some faces with multiple triangles instead of single > triangle per face. Looks like cgal can't handle that but the rest of the > system can. The STL file it exported was correct.. > > On 24 December 2015 at 07:45, Mekko <serve@perdix.org> wrote: > >> LOL. Actually, I'm not the potato chip guy - I'm just trying to cut a >> sphere >> in half with an hyperbola and getting a potato chip instead. >> >> Hopefully the true Potato Chip Guy is reading this thread though! >> >> >> >> -- >> View this message in context: >> http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15313.html >> Sent from the OpenSCAD mailing list archive at Nabble.com. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
NH
nop head
Thu, Dec 24, 2015 1:58 PM

Here is a slightly simpler version without the use of flatten plus a few
comments: -

xmin = -1;
xmax = 1;
ymin = -1;
ymax = 1;
step = 0.05;
zmin = min(xmin * ymax, xmax * ymin);

xpoints = floor((xmax - xmin) / step) + 1;
ypoints = floor((ymax - ymin) / step) + 1;
function index(x,y) = x * ypoints + y + 2; // plus 2 because of two extra
points added to make the base
function x(i) = xmin + i * step;
function y(i) = ymin + i * step;

points = concat([[xmin, ymin, zmin]], // two extra points to allow a
rectangular base
[[xmax, ymax, zmin]],
[for(i = [0 : xpoints - 1], j = [0 : ypoints - 1]) [x(i),
y(j), x(i) * y(j)]]);

base = concat(
[[1, 0, index(xpoints - 1, 0)]], // two triangles to make the base
[[0, 1, index(0, ypoints - 1)]],
// four triangule fans for the sides
[for(i = [0 : xpoints - 2]) [0, index(i, 0), index(i + 1, 0)]],
[for(i = [0 : xpoints - 2]) [1, index(i + 1, ypoints - 1), index(i,
ypoints - 1)]],
[for(j = [0 : ypoints - 2]) [0, index(0, j + 1), index(0, j)]],
[for(j = [0 : ypoints - 2]) [1, index(xpoints - 1, j),
index(xpoints - 1, j + 1)]]
);

faces = concat( // connect every four points with two triangles
[for(i = [0 : xpoints - 2], j = [0 : ypoints - 2]) [index(i,j),
index(i, j + 1), index(i + 1, j + 1)]],
[for(i = [0 : xpoints - 2], j = [0 : ypoints - 2]) [index(i + 1, j

  • 1), index(i + 1, j ), index(i, j)]]
    );

difference() {
sphere(r= 0.5, $fn=80);
polyhedron(points, concat(base, faces), convexity = 2);
}

On 24 December 2015 at 13:51, nop head nop.head@gmail.com wrote:

Simply cut and paste it from the email. There is no line 38, so I think
you cut one too many lines.

On 24 December 2015 at 12:57, Kenneth Sloan kennethrsloan@gmail.com
wrote:

Looks nice.  So…I tried to copy it to play with it (and understand it).

I get:

ERROR: Parser error in line 38: syntax error
ERROR: Conmpilation failed!

Presumably, that’s because I’m behind on my updates.
What version do I need, please?

--
Kenneth Sloan
KennethRSloan@gmail.com
Vision is the art of seeing what is invisible to others.

On Dec 24, 2015, at 04:01 , nop head nop.head@gmail.com wrote:

Here is a version that finally works.

<hyperbola.png>

xmin = -1;
xmax = 1;
ymin = -1;
ymax = 1;
step = 0.05;
zmin = min(xmin *ymax, xmax * ymin);

xpoints = floor((xmax - xmin) / step) + 1;
ypoints = floor((ymax - ymin) / step) + 1;
function index(x,y) = x * ypoints + y + 2;
function x(i) = xmin + i * step;
function y(i) = ymin + i * step;

points = concat([[xmin, ymin, zmin]],
[[xmax, ymax, zmin]],
[for(i = [0 : xpoints - 1]) for(j = [0 : ypoints - 1]) [x(i),
y(j), x(i) * y(j)]]);

function flatten(l) = [for(a = l) for (b = a) b];

base = concat(
[[1, 0, index(xpoints - 1, 0)]],
[[0, 1, index(0, ypoints - 1)]],
[for(i = [0 : xpoints - 2]) [0, index(i, 0), index(i + 1, 0)]],
[for(j = [0 : ypoints - 2]) [0, index(0, j + 1), index(0, j)]],
[for(i = [0 : xpoints - 2]) [1, index(i + 1, ypoints - 1),
index(i, ypoints - 1)]],
[for(j = [0 : ypoints - 2]) [1, index(xpoints - 1, j),
index(xpoints - 1, j + 1)]]
);

faces = flatten([for(i = [0 : xpoints - 2]) for(j = [0 : ypoints - 2])
[[index(i,j), index(i, j + 1), index(i + 1, j + 1)],
[index(i + 1, j + 1), index(i + 1, j ), index(i, j)]]
]);

difference() {
sphere(r= 0.5, $fn=80);
polyhedron(points, concat(base, faces), convexity = 2);
}

My stupid mistake was flattening the base list when it didn't need to be.
The result was some faces with multiple triangles instead of single
triangle per face. Looks like cgal can't handle that but the rest of the
system can. The STL file it exported was correct..

On 24 December 2015 at 07:45, Mekko serve@perdix.org wrote:

LOL. Actually, I'm not the potato chip guy - I'm just trying to cut a
sphere
in half with an hyperbola and getting a potato chip instead.

Hopefully the true Potato Chip Guy is reading this thread though!

--
View this message in context:
http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15313.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Here is a slightly simpler version without the use of flatten plus a few comments: - xmin = -1; xmax = 1; ymin = -1; ymax = 1; step = 0.05; zmin = min(xmin * ymax, xmax * ymin); xpoints = floor((xmax - xmin) / step) + 1; ypoints = floor((ymax - ymin) / step) + 1; function index(x,y) = x * ypoints + y + 2; // plus 2 because of two extra points added to make the base function x(i) = xmin + i * step; function y(i) = ymin + i * step; points = concat([[xmin, ymin, zmin]], // two extra points to allow a rectangular base [[xmax, ymax, zmin]], [for(i = [0 : xpoints - 1], j = [0 : ypoints - 1]) [x(i), y(j), x(i) * y(j)]]); base = concat( [[1, 0, index(xpoints - 1, 0)]], // two triangles to make the base [[0, 1, index(0, ypoints - 1)]], // four triangule fans for the sides [for(i = [0 : xpoints - 2]) [0, index(i, 0), index(i + 1, 0)]], [for(i = [0 : xpoints - 2]) [1, index(i + 1, ypoints - 1), index(i, ypoints - 1)]], [for(j = [0 : ypoints - 2]) [0, index(0, j + 1), index(0, j)]], [for(j = [0 : ypoints - 2]) [1, index(xpoints - 1, j), index(xpoints - 1, j + 1)]] ); faces = concat( // connect every four points with two triangles [for(i = [0 : xpoints - 2], j = [0 : ypoints - 2]) [index(i,j), index(i, j + 1), index(i + 1, j + 1)]], [for(i = [0 : xpoints - 2], j = [0 : ypoints - 2]) [index(i + 1, j + 1), index(i + 1, j ), index(i, j)]] ); difference() { sphere(r= 0.5, $fn=80); polyhedron(points, concat(base, faces), convexity = 2); } On 24 December 2015 at 13:51, nop head <nop.head@gmail.com> wrote: > Simply cut and paste it from the email. There is no line 38, so I think > you cut one too many lines. > > On 24 December 2015 at 12:57, Kenneth Sloan <kennethrsloan@gmail.com> > wrote: > >> Looks nice. So…I tried to copy it to play with it (and understand it). >> >> I get: >> >> ERROR: Parser error in line 38: syntax error >> ERROR: Conmpilation failed! >> >> Presumably, that’s because I’m behind on my updates. >> What version do I need, please? >> >> -- >> Kenneth Sloan >> KennethRSloan@gmail.com >> Vision is the art of seeing what is invisible to others. >> >> >> >> >> On Dec 24, 2015, at 04:01 , nop head <nop.head@gmail.com> wrote: >> >> Here is a version that finally works. >> >> <hyperbola.png> >> ​ >> xmin = -1; >> xmax = 1; >> ymin = -1; >> ymax = 1; >> step = 0.05; >> zmin = min(xmin *ymax, xmax * ymin); >> >> xpoints = floor((xmax - xmin) / step) + 1; >> ypoints = floor((ymax - ymin) / step) + 1; >> function index(x,y) = x * ypoints + y + 2; >> function x(i) = xmin + i * step; >> function y(i) = ymin + i * step; >> >> points = concat([[xmin, ymin, zmin]], >> [[xmax, ymax, zmin]], >> [for(i = [0 : xpoints - 1]) for(j = [0 : ypoints - 1]) [x(i), >> y(j), x(i) * y(j)]]); >> >> function flatten(l) = [for(a = l) for (b = a) b]; >> >> base = concat( >> [[1, 0, index(xpoints - 1, 0)]], >> [[0, 1, index(0, ypoints - 1)]], >> [for(i = [0 : xpoints - 2]) [0, index(i, 0), index(i + 1, 0)]], >> [for(j = [0 : ypoints - 2]) [0, index(0, j + 1), index(0, j)]], >> [for(i = [0 : xpoints - 2]) [1, index(i + 1, ypoints - 1), >> index(i, ypoints - 1)]], >> [for(j = [0 : ypoints - 2]) [1, index(xpoints - 1, j), >> index(xpoints - 1, j + 1)]] >> ); >> >> faces = flatten([for(i = [0 : xpoints - 2]) for(j = [0 : ypoints - 2]) >> [[index(i,j), index(i, j + 1), index(i + 1, j + 1)], >> [index(i + 1, j + 1), index(i + 1, j ), index(i, j)]] >> ]); >> >> difference() { >> sphere(r= 0.5, $fn=80); >> polyhedron(points, concat(base, faces), convexity = 2); >> } >> ​ >> >> My stupid mistake was flattening the base list when it didn't need to be. >> The result was some faces with multiple triangles instead of single >> triangle per face. Looks like cgal can't handle that but the rest of the >> system can. The STL file it exported was correct.. >> >> On 24 December 2015 at 07:45, Mekko <serve@perdix.org> wrote: >> >>> LOL. Actually, I'm not the potato chip guy - I'm just trying to cut a >>> sphere >>> in half with an hyperbola and getting a potato chip instead. >>> >>> Hopefully the true Potato Chip Guy is reading this thread though! >>> >>> >>> >>> -- >>> View this message in context: >>> http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15313.html >>> Sent from the OpenSCAD mailing list archive at Nabble.com. >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> Discuss@lists.openscad.org >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> >
KS
Kenneth Sloan
Thu, Dec 24, 2015 3:14 PM

Thanks.  There was <white-space> at the end.  I removed it and all is well.

So, now the question is: why is <white-space> a syntax error?

Perhaps not an important question - but it is puzzling (to me).

--
Kenneth Sloan
KennethRSloan@gmail.com mailto:KennethRSloan@gmail.com
Vision is the art of seeing what is invisible to others.

On Dec 24, 2015, at 07:51 , nop head nop.head@gmail.com wrote:

Simply cut and paste it from the email. There is no line 38, so I think you cut one too many lines.

On 24 December 2015 at 12:57, Kenneth Sloan <kennethrsloan@gmail.com mailto:kennethrsloan@gmail.com> wrote:
Looks nice.  So…I tried to copy it to play with it (and understand it).

I get:

ERROR: Parser error in line 38: syntax error
ERROR: Conmpilation failed!

Presumably, that’s because I’m behind on my updates.
What version do I need, please?

--
Kenneth Sloan
KennethRSloan@gmail.com mailto:KennethRSloan@gmail.com
Vision is the art of seeing what is invisible to others.

On Dec 24, 2015, at 04:01 , nop head <nop.head@gmail.com mailto:nop.head@gmail.com> wrote:

Here is a version that finally works.

<hyperbola.png>

xmin = -1;
xmax = 1;
ymin = -1;
ymax = 1;
step = 0.05;
zmin = min(xmin *ymax, xmax * ymin);

xpoints = floor((xmax - xmin) / step) + 1;
ypoints = floor((ymax - ymin) / step) + 1;
function index(x,y) = x * ypoints + y + 2;
function x(i) = xmin + i * step;
function y(i) = ymin + i * step;

points = concat([[xmin, ymin, zmin]],
[[xmax, ymax, zmin]],
[for(i = [0 : xpoints - 1]) for(j = [0 : ypoints - 1]) [x(i), y(j), x(i) * y(j)]]);

function flatten(l) = [for(a = l) for (b = a) b];

base = concat(
[[1, 0, index(xpoints - 1, 0)]],
[[0, 1, index(0, ypoints - 1)]],
[for(i = [0 : xpoints - 2]) [0, index(i, 0), index(i + 1, 0)]],
[for(j = [0 : ypoints - 2]) [0, index(0, j + 1), index(0, j)]],
[for(i = [0 : xpoints - 2]) [1, index(i + 1, ypoints - 1), index(i, ypoints - 1)]],
[for(j = [0 : ypoints - 2]) [1, index(xpoints - 1, j), index(xpoints - 1, j + 1)]]
);

faces = flatten([for(i = [0 : xpoints - 2]) for(j = [0 : ypoints - 2])
[[index(i,j), index(i, j + 1), index(i + 1, j + 1)],
[index(i + 1, j + 1), index(i + 1, j ), index(i, j)]]
]);

difference() {
sphere(r= 0.5, $fn=80);
polyhedron(points, concat(base, faces), convexity = 2);
}

My stupid mistake was flattening the base list when it didn't need to be. The result was some faces with multiple triangles instead of single triangle per face. Looks like cgal can't handle that but the rest of the system can. The STL file it exported was correct..

On 24 December 2015 at 07:45, Mekko <serve@perdix.org mailto:serve@perdix.org> wrote:
LOL. Actually, I'm not the potato chip guy - I'm just trying to cut a sphere
in half with an hyperbola and getting a potato chip instead.

Hopefully the true Potato Chip Guy is reading this thread though!

--
View this message in context: http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15313.html http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15313.html
Sent from the OpenSCAD mailing list archive at Nabble.com http://nabble.com/.


OpenSCAD mailing list
Discuss@lists.openscad.org mailto:Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


OpenSCAD mailing list
Discuss@lists.openscad.org mailto:Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Thanks. There was <white-space> at the end. I removed it and all is well. So, now the question is: why is <white-space> a syntax error? Perhaps not an important question - but it is puzzling (to me). -- Kenneth Sloan KennethRSloan@gmail.com <mailto:KennethRSloan@gmail.com> Vision is the art of seeing what is invisible to others. > On Dec 24, 2015, at 07:51 , nop head <nop.head@gmail.com> wrote: > > Simply cut and paste it from the email. There is no line 38, so I think you cut one too many lines. > > On 24 December 2015 at 12:57, Kenneth Sloan <kennethrsloan@gmail.com <mailto:kennethrsloan@gmail.com>> wrote: > Looks nice. So…I tried to copy it to play with it (and understand it). > > I get: > > ERROR: Parser error in line 38: syntax error > ERROR: Conmpilation failed! > > Presumably, that’s because I’m behind on my updates. > What version do I need, please? > > -- > Kenneth Sloan > KennethRSloan@gmail.com <mailto:KennethRSloan@gmail.com> > Vision is the art of seeing what is invisible to others. > > > > >> On Dec 24, 2015, at 04:01 , nop head <nop.head@gmail.com <mailto:nop.head@gmail.com>> wrote: >> >> Here is a version that finally works. >> >> <hyperbola.png> >> ​ >> xmin = -1; >> xmax = 1; >> ymin = -1; >> ymax = 1; >> step = 0.05; >> zmin = min(xmin *ymax, xmax * ymin); >> >> xpoints = floor((xmax - xmin) / step) + 1; >> ypoints = floor((ymax - ymin) / step) + 1; >> function index(x,y) = x * ypoints + y + 2; >> function x(i) = xmin + i * step; >> function y(i) = ymin + i * step; >> >> points = concat([[xmin, ymin, zmin]], >> [[xmax, ymax, zmin]], >> [for(i = [0 : xpoints - 1]) for(j = [0 : ypoints - 1]) [x(i), y(j), x(i) * y(j)]]); >> >> function flatten(l) = [for(a = l) for (b = a) b]; >> >> base = concat( >> [[1, 0, index(xpoints - 1, 0)]], >> [[0, 1, index(0, ypoints - 1)]], >> [for(i = [0 : xpoints - 2]) [0, index(i, 0), index(i + 1, 0)]], >> [for(j = [0 : ypoints - 2]) [0, index(0, j + 1), index(0, j)]], >> [for(i = [0 : xpoints - 2]) [1, index(i + 1, ypoints - 1), index(i, ypoints - 1)]], >> [for(j = [0 : ypoints - 2]) [1, index(xpoints - 1, j), index(xpoints - 1, j + 1)]] >> ); >> >> faces = flatten([for(i = [0 : xpoints - 2]) for(j = [0 : ypoints - 2]) >> [[index(i,j), index(i, j + 1), index(i + 1, j + 1)], >> [index(i + 1, j + 1), index(i + 1, j ), index(i, j)]] >> ]); >> >> difference() { >> sphere(r= 0.5, $fn=80); >> polyhedron(points, concat(base, faces), convexity = 2); >> } >> ​ >> >> My stupid mistake was flattening the base list when it didn't need to be. The result was some faces with multiple triangles instead of single triangle per face. Looks like cgal can't handle that but the rest of the system can. The STL file it exported was correct.. >> >> On 24 December 2015 at 07:45, Mekko <serve@perdix.org <mailto:serve@perdix.org>> wrote: >> LOL. Actually, I'm not the potato chip guy - I'm just trying to cut a sphere >> in half with an hyperbola and getting a potato chip instead. >> >> Hopefully the true Potato Chip Guy is reading this thread though! >> >> >> >> -- >> View this message in context: http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15313.html <http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15313.html> >> Sent from the OpenSCAD mailing list archive at Nabble.com <http://nabble.com/>. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org <http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org <http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org> > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org <http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org> > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
NH
nop head
Thu, Dec 24, 2015 3:51 PM

White space isn't a syntax error, perhaps it contained an invisible control
character or something.

On 24 December 2015 at 15:14, Kenneth Sloan kennethrsloan@gmail.com wrote:

Thanks.  There was <white-space> at the end.  I removed it and all is well.

So, now the question is: why is <white-space> a syntax error?

Perhaps not an important question - but it is puzzling (to me).

--
Kenneth Sloan
KennethRSloan@gmail.com
Vision is the art of seeing what is invisible to others.

On Dec 24, 2015, at 07:51 , nop head nop.head@gmail.com wrote:

Simply cut and paste it from the email. There is no line 38, so I think
you cut one too many lines.

On 24 December 2015 at 12:57, Kenneth Sloan kennethrsloan@gmail.com
wrote:

Looks nice.  So…I tried to copy it to play with it (and understand it).

I get:

ERROR: Parser error in line 38: syntax error
ERROR: Conmpilation failed!

Presumably, that’s because I’m behind on my updates.
What version do I need, please?

--
Kenneth Sloan
KennethRSloan@gmail.com
Vision is the art of seeing what is invisible to others.

On Dec 24, 2015, at 04:01 , nop head nop.head@gmail.com wrote:

Here is a version that finally works.

<hyperbola.png>

xmin = -1;
xmax = 1;
ymin = -1;
ymax = 1;
step = 0.05;
zmin = min(xmin *ymax, xmax * ymin);

xpoints = floor((xmax - xmin) / step) + 1;
ypoints = floor((ymax - ymin) / step) + 1;
function index(x,y) = x * ypoints + y + 2;
function x(i) = xmin + i * step;
function y(i) = ymin + i * step;

points = concat([[xmin, ymin, zmin]],
[[xmax, ymax, zmin]],
[for(i = [0 : xpoints - 1]) for(j = [0 : ypoints - 1]) [x(i),
y(j), x(i) * y(j)]]);

function flatten(l) = [for(a = l) for (b = a) b];

base = concat(
[[1, 0, index(xpoints - 1, 0)]],
[[0, 1, index(0, ypoints - 1)]],
[for(i = [0 : xpoints - 2]) [0, index(i, 0), index(i + 1, 0)]],
[for(j = [0 : ypoints - 2]) [0, index(0, j + 1), index(0, j)]],
[for(i = [0 : xpoints - 2]) [1, index(i + 1, ypoints - 1),
index(i, ypoints - 1)]],
[for(j = [0 : ypoints - 2]) [1, index(xpoints - 1, j),
index(xpoints - 1, j + 1)]]
);

faces = flatten([for(i = [0 : xpoints - 2]) for(j = [0 : ypoints - 2])
[[index(i,j), index(i, j + 1), index(i + 1, j + 1)],
[index(i + 1, j + 1), index(i + 1, j ), index(i, j)]]
]);

difference() {
sphere(r= 0.5, $fn=80);
polyhedron(points, concat(base, faces), convexity = 2);
}

My stupid mistake was flattening the base list when it didn't need to be.
The result was some faces with multiple triangles instead of single
triangle per face. Looks like cgal can't handle that but the rest of the
system can. The STL file it exported was correct..

On 24 December 2015 at 07:45, Mekko serve@perdix.org wrote:

LOL. Actually, I'm not the potato chip guy - I'm just trying to cut a
sphere
in half with an hyperbola and getting a potato chip instead.

Hopefully the true Potato Chip Guy is reading this thread though!

--
View this message in context:
http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15313.html
Sent from the OpenSCAD mailing list archive at Nabble.com
http://nabble.com/.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

White space isn't a syntax error, perhaps it contained an invisible control character or something. On 24 December 2015 at 15:14, Kenneth Sloan <kennethrsloan@gmail.com> wrote: > Thanks. There was <white-space> at the end. I removed it and all is well. > > So, now the question is: why is <white-space> a syntax error? > > Perhaps not an important question - but it is puzzling (to me). > > > -- > Kenneth Sloan > KennethRSloan@gmail.com > Vision is the art of seeing what is invisible to others. > > > > > On Dec 24, 2015, at 07:51 , nop head <nop.head@gmail.com> wrote: > > Simply cut and paste it from the email. There is no line 38, so I think > you cut one too many lines. > > On 24 December 2015 at 12:57, Kenneth Sloan <kennethrsloan@gmail.com> > wrote: > >> Looks nice. So…I tried to copy it to play with it (and understand it). >> >> I get: >> >> ERROR: Parser error in line 38: syntax error >> ERROR: Conmpilation failed! >> >> Presumably, that’s because I’m behind on my updates. >> What version do I need, please? >> >> -- >> Kenneth Sloan >> KennethRSloan@gmail.com >> Vision is the art of seeing what is invisible to others. >> >> >> >> >> On Dec 24, 2015, at 04:01 , nop head <nop.head@gmail.com> wrote: >> >> Here is a version that finally works. >> >> <hyperbola.png> >> ​ >> xmin = -1; >> xmax = 1; >> ymin = -1; >> ymax = 1; >> step = 0.05; >> zmin = min(xmin *ymax, xmax * ymin); >> >> xpoints = floor((xmax - xmin) / step) + 1; >> ypoints = floor((ymax - ymin) / step) + 1; >> function index(x,y) = x * ypoints + y + 2; >> function x(i) = xmin + i * step; >> function y(i) = ymin + i * step; >> >> points = concat([[xmin, ymin, zmin]], >> [[xmax, ymax, zmin]], >> [for(i = [0 : xpoints - 1]) for(j = [0 : ypoints - 1]) [x(i), >> y(j), x(i) * y(j)]]); >> >> function flatten(l) = [for(a = l) for (b = a) b]; >> >> base = concat( >> [[1, 0, index(xpoints - 1, 0)]], >> [[0, 1, index(0, ypoints - 1)]], >> [for(i = [0 : xpoints - 2]) [0, index(i, 0), index(i + 1, 0)]], >> [for(j = [0 : ypoints - 2]) [0, index(0, j + 1), index(0, j)]], >> [for(i = [0 : xpoints - 2]) [1, index(i + 1, ypoints - 1), >> index(i, ypoints - 1)]], >> [for(j = [0 : ypoints - 2]) [1, index(xpoints - 1, j), >> index(xpoints - 1, j + 1)]] >> ); >> >> faces = flatten([for(i = [0 : xpoints - 2]) for(j = [0 : ypoints - 2]) >> [[index(i,j), index(i, j + 1), index(i + 1, j + 1)], >> [index(i + 1, j + 1), index(i + 1, j ), index(i, j)]] >> ]); >> >> difference() { >> sphere(r= 0.5, $fn=80); >> polyhedron(points, concat(base, faces), convexity = 2); >> } >> ​ >> >> My stupid mistake was flattening the base list when it didn't need to be. >> The result was some faces with multiple triangles instead of single >> triangle per face. Looks like cgal can't handle that but the rest of the >> system can. The STL file it exported was correct.. >> >> On 24 December 2015 at 07:45, Mekko <serve@perdix.org> wrote: >> >>> LOL. Actually, I'm not the potato chip guy - I'm just trying to cut a >>> sphere >>> in half with an hyperbola and getting a potato chip instead. >>> >>> Hopefully the true Potato Chip Guy is reading this thread though! >>> >>> >>> >>> -- >>> View this message in context: >>> http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15313.html >>> Sent from the OpenSCAD mailing list archive at Nabble.com >>> <http://nabble.com/>. >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> Discuss@lists.openscad.org >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
M
Mekko
Fri, Dec 25, 2015 5:13 AM

nophead, this is beautiful - thanks!

The comments are particularly helpful to me as I design more complex shapes
that can't be composed from cylinder(), cube(), sphere(), etc.

--
View this message in context: http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15335.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

nophead, this is beautiful - thanks! The comments are particularly helpful to me as I design more complex shapes that can't be composed from cylinder(), cube(), sphere(), etc. -- View this message in context: http://forum.openscad.org/intersecting-with-an-hyperbola-tp15280p15335.html Sent from the OpenSCAD mailing list archive at Nabble.com.