On Wed, Jan 23, 2019 at 10:05:58PM +0000, nop head wrote:

> If I reverse the handedness of the spiral then the other diagonal is the

> correct one. Does anybody know the correct algorithm? The length of the two

> diagonals is the same so that can't be used to choose between them.

The current rendering uses a single shade that depends on the normal

of the triangle.

If the length of the diagonals are not equal, chosing the shorter

triangle reduces the "aspect ratio" (longest possible line segment

divided by the largest perpendicular segment). As an example: imagine

two equilateral triangles joined to a rhombus.

Split them into the two original triangles and the aspect ratio is

almost one (sqrt(3)/2 iirc). Split it the other way and you get a much

larger aspect ratio. Something like sqrt(3) or even more.

The aspect ratio being small means that the points of that triangle

will be colored the same to "close" points. A pointy triangle has

points far away that will be colored the same due to having the same

normal.

For presentation (i.e. not 3D printing) you can do "phong

shading". This has something to do with averaging colors close to an

edge between two triangles. An object shaded that way will look

"perfectly round" until you start examining the image at the pixel

scale. This would be great for quick rendering realistic

representation of an object where you're working with a low $fn during

development but are going to increase $fn for final rendering to be

printed.

> I am thinking that one way makes a convex surface patch and the other way

> concave. I think that if the surface is convex in the area of the patch

> then the diagonal should be chosen to give a convex patch and vice versa.

> Does that make sense?

That sounds like a plan.

> Not sure how I would code that efficiently. Is there a better way than

> calculating the normals of the triangles to determine if the patch is

> concave or convex. And is there an easy way to determine if the surface is

> locally concave or convex? In this case it is always convex so I could

> cheat and always assume that. It would be right most of the time as a swept

> surface must always be partially convex.

The inside of the spring is concave (in one direction) (I'm guessing that

this is exaclty the "partially convex" that you say :-) ).

Roger.

--

**

[hidden email] **

https://www.BitWizard.nl/ ** +31-15-2049110 **

** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **

The plan was simple, like my brother-in-law Phil. But unlike

Phil, this plan just might work.

_______________________________________________

OpenSCAD mailing list

[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org