rotate does not always render

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

rotate does not always render

Eric Palmer

The following renders properly but some x angles don't


$fulcrumBase = 15;

$fulcrumHt = 20;

$fulcrumDepth = 20;

module fulcrum($base, $ht, $depth) {

rotate(a=[260,0,0]) {

polygon(points=[[0,0], [$base,0,], [$base/2,$ht], [0,0]]);

}

}

fulcrum($fulcrumBase, $fulcrumHt, $fulcrumDepth);


if I make the rotate [270,0,0] I get a the following error

WARNING: No top level geometry to render


Other x angles don't work as well like -90


if I make the x angle 270.1 it renders looking like a line and not a triangle.


Mac os x 10.6.8

2011.12 openSCAD


Thanks in advance for any help.


Eric




--
http://www.thingiverse.com/DaddyOh
Join the 3DPrinter Revolution
http://makerbot.com

Reply | Threaded
Open this post in threaded view
|

Re: rotate does not always render

Whosawhatsis
I had to do some testing before I figured out what you were trying to say. the problem is that you're rotating a 2d polygon around the X axis and then doing an implicit projection back onto the x/y plane when you do a CGAL render. With angles of 90° or 270° (or -90°, which is the same angle as 270°), this projection produces does not show anything because the polygon that it would render is zero-width. The OpenCSG renderer implicitly extrudes all 2D polygons before rendering them because it can't display 2D shapes, but you will have to do this explicitly if you want them to appear the same way in a CGAL render.

On Saturday, January 21, 2012 at 7:11 AM, Eric Palmer wrote:

The following renders properly but some x angles don't


$fulcrumBase = 15;

$fulcrumHt = 20;

$fulcrumDepth = 20;

module fulcrum($base, $ht, $depth) {

rotate(a=[260,0,0]) {

polygon(points=[[0,0], [$base,0,], [$base/2,$ht], [0,0]]);

}

}

fulcrum($fulcrumBase, $fulcrumHt, $fulcrumDepth);


if I make the rotate [270,0,0] I get a the following error

WARNING: No top level geometry to render


Other x angles don't work as well like -90


if I make the x angle 270.1 it renders looking like a line and not a triangle.


Mac os x 10.6.8

2011.12 openSCAD


Thanks in advance for any help.


Eric




--
http://www.thingiverse.com/DaddyOh
Join the 3DPrinter Revolution
http://makerbot.com

_______________________________________________
OpenSCAD mailing list

Reply | Threaded
Open this post in threaded view
|

Re: rotate does not always render

Eric Palmer
Excellent.  This answer helps me understand how openSCAD works.  Thanks so much.

Eric

On Sat, Jan 21, 2012 at 12:01 PM, Whosawhatsis <[hidden email]> wrote:
I had to do some testing before I figured out what you were trying to say. the problem is that you're rotating a 2d polygon around the X axis and then doing an implicit projection back onto the x/y plane when you do a CGAL render. With angles of 90° or 270° (or -90°, which is the same angle as 270°), this projection produces does not show anything because the polygon that it would render is zero-width. The OpenCSG renderer implicitly extrudes all 2D polygons before rendering them because it can't display 2D shapes, but you will have to do this explicitly if you want them to appear the same way in a CGAL render.

On Saturday, January 21, 2012 at 7:11 AM, Eric Palmer wrote:

The following renders properly but some x angles don't


$fulcrumBase = 15;

$fulcrumHt = 20;

$fulcrumDepth = 20;

module fulcrum($base, $ht, $depth) {

rotate(a=[260,0,0]) {

polygon(points=[[0,0], [$base,0,], [$base/2,$ht], [0,0]]);

}

}

fulcrum($fulcrumBase, $fulcrumHt, $fulcrumDepth);


if I make the rotate [270,0,0] I get a the following error

WARNING: No top level geometry to render


Other x angles don't work as well like -90


if I make the x angle 270.1 it renders looking like a line and not a triangle.


Mac os x 10.6.8

2011.12 openSCAD


Thanks in advance for any help.


Eric




--
http://www.thingiverse.com/DaddyOh
Join the 3DPrinter Revolution
http://makerbot.com

_______________________________________________
OpenSCAD mailing list


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad




--
http://www.thingiverse.com/DaddyOh
Join the 3DPrinter Revolution
http://makerbot.com

Reply | Threaded
Open this post in threaded view
|

graph a math function on a 2D polygon

cdriko
hello
i'm trying to graph a mathematical function on a 2D polygon , but I don't no how doing this

I wanted to stock all points of the 2D polygon in an array before using them but
it seems that we can't do another thing than drawing a primitive in a "for" loop :
for example this :



for(x=[0:180]){
y=(x*x)/(4*200);
echo (y);
}

stops compiling at line y=....

any idea ?

Practicaly, it's to generate plywood shapes for a solar concentrator.

Reply | Threaded
Open this post in threaded view
|

Re: graph a math function on a 2D polygon

nophead
You need to use the assign() statement to create new variables inside a loop.

To make the polygon from an unknown number of points I think you will need to use hull() of lots of tiny circles.

On 22 January 2012 09:15, <[hidden email]> wrote:
hello
i'm trying to graph a mathematical function on a 2D polygon , but I don't no how doing this

I wanted to stock all points of the 2D polygon in an array before using them but
it seems that we can't do another thing than drawing a primitive in a "for" loop :
for example this :



for(x=[0:180]){
y=(x*x)/(4*200);
echo (y);
}

stops compiling at line y=....

any idea ?

Practicaly, it's to generate plywood shapes for a solar concentrator.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: graph a math function on a 2D polygon

Brad Pitcher
In reply to this post by cdriko

If I understand you right, my 2D graphing library I'd exactly what you need: http://www.thingiverse.com/thing:11243
No need to reinvent the wheel. ;-)

On Jan 22, 2012 1:15 AM, <[hidden email]> wrote:
hello
i'm trying to graph a mathematical function on a 2D polygon , but I don't no how doing this

I wanted to stock all points of the 2D polygon in an array before using them but
it seems that we can't do another thing than drawing a primitive in a "for" loop :
for example this :



for(x=[0:180]){
y=(x*x)/(4*200);
echo (y);
}

stops compiling at line y=....

any idea ?

Practicaly, it's to generate plywood shapes for a solar concentrator.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad