[OpenSCAD] Irregular mesh generated

runsun runsun at gmail.com
Sat Sep 12 03:40:45 EDT 2015


Since the points can be obtained through function, it is possible to make
more points along the hull lines. In the following figure, a hull line, PQ,
which we already know the coordinates, are divided into multiple segments:

<http://forum.openscad.org/file/n13779/Oloid_20150912_KitWallace.png> 

Here are the two functions I use to create those segment points:

> function 
*
> onlinePt
*
>  ( pq, len=undef, ratio=0.5 )=
> (
>     let( pq = [pq[0],pq[1]]
>        , L = isnum(len)?mm*len/dist(pq):ratio)
> 	[ L*dist(pq,"x")+pq[0].x
> 	, L*dist(pq,"y")+pq[0].y 
> 	, L*dist(pq,"z")+pq[0].z ] 
> );
> 
> function 
*
> onlinePts
*
>  ( pq, lens=false, ratios=false )=
> (
> 	ratios==false?
> 	( len(lens)==0?[]
> 	  :	[for(l=lens) onlinePt( pq, len=l)]
> 	):
> 	( len(ratios)==0?[]
>       : [for(r=ratios) onlinePt(pq,ratio=r)]
> 	)
> );

The 1st ( *onlinePt* ) creates a single pt between PQ, the 2nd ( *onlinePts*
) creates multiple pts. Some required functions are not included, but they
are straightforward and easy to make. 

I use the following to create the above segment pts:

>     onlinePts( [P,Q] ratios=[0:0.1:1] )




kitwallace wrote
> Thanks for the tip.  I've not encountered Wings 3D and its a wonderful
> tool and great fun.
> 
> However I can't get your suggestion to work on the objects I have in mind
> with skinny triangles eg. the Oloid see
> http://kitwallace.tumblr.com/post/85636282539/oloid generated by 
> 
> module oloid(r,h=0.1) {
>    hull() {
>      cylinder(r=r,h=h);
>      translate([0,pow(2,0.5)*r,0])  // two-point roller
>          rotate([0,90,0])
>             cylinder(r=r,h=h);
>    }
> };
> 
> $fn=50;
> oloid(20);
> 
> (actually Wings finds holes in this solid)
> 
> Seems to me that inset and bevel just makes even more skinny triangles.





-----

$  Runsun Pan, PhD 

$ -- libs: doctest , faces ( git ), offliner ( git );

 tips: hash( 1 , 2 ), sweep , var 

$ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly 




--
View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13779.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list