Problem with skin()

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

Problem with skin()

B29Parts
I have a larger model where F5 works but F6 fails.  The problem seems to be related to what I'm generating using skin().  Here's a small model that shows the problem:

<quote>
use <scad-utils/transformations.scad>
use <scad-utils/lists.scad>
use <scad-utils/shapes.scad>
use <skin.scad>

airfoil_inch = [ [0.00,0.00], [.031,.084], [.062,.123], [.125,.176], [.250,.243],
                 [.375,.290], [.500,.324], [.625,.349], [.750,.366], [1.00,.375],
                 [1.25,.343], [1.50,.285], [1.75,.208], [2.00,.126], [2.25,0.00] ];
 
scale_factor = 1.82/2.5;
            
airfoil_mm = [ for (i = [0:len(airfoil_inch)-1]) airfoil_inch[i]*25.4 ];
airfoil_mm_scaled = [ for (i = [0:len(airfoil_inch)-1]) scale_factor*airfoil_mm[i] ];

color("red") translate([30,0,0]) skin([
transform(translation([-25.4,0,0]), airfoil_mm),
transform(translation([-scale_factor*25.4,0,25.4]), airfoil_mm_scaled)
]);

translate([-35,0,0]) linear_extrude(height = 25.4, center = false, convexity = 10, twist = 0, scale = scale_factor)
  translate([-25.4,0,0]) polygon(points = airfoil_mm);
</quote>

When I turn on Thrown Together, the red airfoil transforms to all "pink".  What I read says this is bad, but I see nothing in the underlying 2D shape that sticks out as a problem.  What am I missing here?  I'm running with OpenSCAD 2015.03-3 on a 10.12.6 Mac.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD 2015.03-3 on a 10.12.6 Mac
Reply | Threaded
Open this post in threaded view
|

Re: Problem with skin()

jon_bondy
Works without a problem here with 2015.03.

Puzzling.

Jon

On 1/13/2018 6:10 PM, [hidden email] wrote:
I have a larger model where F5 works but F6 fails.  The problem seems to be related to what I'm generating using skin().  Here's a small model that shows the problem:

<quote>
use <scad-utils/transformations.scad>
use <scad-utils/lists.scad>
use <scad-utils/shapes.scad>
use <skin.scad>

airfoil_inch = [ [0.00,0.00], [.031,.084], [.062,.123], [.125,.176], [.250,.243],
                 [.375,.290], [.500,.324], [.625,.349], [.750,.366], [1.00,.375],
                 [1.25,.343], [1.50,.285], [1.75,.208], [2.00,.126], [2.25,0.00] ];
 
scale_factor = 1.82/2.5;
            
airfoil_mm = [ for (i = [0:len(airfoil_inch)-1]) airfoil_inch[i]*25.4 ];
airfoil_mm_scaled = [ for (i = [0:len(airfoil_inch)-1]) scale_factor*airfoil_mm[i] ];

color("red") translate([30,0,0]) skin([
transform(translation([-25.4,0,0]), airfoil_mm),
transform(translation([-scale_factor*25.4,0,25.4]), airfoil_mm_scaled)
]);

translate([-35,0,0]) linear_extrude(height = 25.4, center = false, convexity = 10, twist = 0, scale = scale_factor)
  translate([-25.4,0,0]) polygon(points = airfoil_mm);
</quote>

When I turn on Thrown Together, the red airfoil transforms to all "pink".  What I read says this is bad, but I see nothing in the underlying 2D shape that sticks out as a problem.  What am I missing here?  I'm running with OpenSCAD 2015.03-3 on a 10.12.6 Mac.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

-- 
Sent from my desktop computer.  
I do not receive emails while away from my desk, 
nor do I receive texts on my main phone number 
(which is a land line).  
If you know that I am on the road, please text me.  
If you know that I am home, please email me.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with skin()

B29Parts
What O/S are you running on? O/S X, PC, Linux?



-----
OpenSCAD 2015.03-3 on a 10.12.6 Mac
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD 2015.03-3 on a 10.12.6 Mac
Reply | Threaded
Open this post in threaded view
|

Re: Problem with skin()

Parkinbot
In reply to this post by B29Parts
It turns pink because you polygon is defined in wrong order. skin() expects

airfoil_inch = reverse([ [0.00,0.00], [.031,.084], [.062,.123], [.125,.176],
[.250,.243],
                 [.375,.290], [.500,.324], [.625,.349], [.750,.366],
[1.00,.375],
                 [1.25,.343], [1.50,.285], [1.75,.208], [2.00,.126],
[2.25,0.00] ]);




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with skin()

B29Parts
Thanks, that works.  From this fix, I gather that when you are defining a 2D polygon to be extruded to 3D, the points have to be defined in a CCW manner (i.e. the right hand rule wrt the z-axis).  linear_extrude must have some way of fixing that, as it doesn't seem to care whether the points are CW or CCW.


-----Original Message-----
From: Parkinbot <[hidden email]>
To: discuss <[hidden email]>
Sent: Sun, Jan 14, 2018 2:27 am
Subject: Re: [OpenSCAD] Problem with skin()

It turns pink because you polygon is defined in wrong order. skin() expects

airfoil_inch = reverse([ [0.00,0.00], [.031,.084], [.062,.123], [.125,.176],
[.250,.243],
[.375,.290], [.500,.324], [.625,.349], [.750,.366],
[1.00,.375],
[1.25,.343], [1.50,.285], [1.75,.208], [2.00,.126],
[2.25,0.00] ]);




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD 2015.03-3 on a 10.12.6 Mac
Reply | Threaded
Open this post in threaded view
|

Re: Problem with skin()

Parkinbot
B29Parts wrote
> From this fix, I gather that when you are defining a 2D polygon to be
> extruded to 3D, the points have to be defined in a CCW manner (i.e. the
> right hand rule wrt the z-axis).  

Well, it depends on the direction you are extruding. You could also call
skin() with polygons in reversed order
 
skin([
        transform(translation([-scale_factor*25.4,0,25.4]), airfoil_mm_scaled),
        transform(translation([-25.4,0,0]), airfoil_mm),
]);

to get the desired result with unreversed vertex order. Always use F12 to
check if you got the right order.




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org