Hi Leonid,
Here is the process I recommend. Jon Hiller independently implemented this in his Open Source code on the AMF wiki. Let me know if this works for you. Note that each curved triangle needs to be subdivided to depth 5, i.e. converted into 1024 planar triangles. Also note that the triangle is assumed not to be “too curved”, i.e. not more than 25% out of plane.
I am planning to do an update to the ASTM spec with this information, so let me know if this makes sense.
Here are the four key functions I used (I can send you code if you want, let me know)
InitializeCurvedTriangle() – This function creates a curved triangle object from information available in the mesh file. This information will include the triangle’s vertices, a normal for each vertex (if specified), and two tangents for each edge (if specified). If either a normal or a tangent is unspecified, it is set to zero. The implementation details of this function depend on the specific overall architecture of your specific AMF data structure.
EstimateTangentsNormals() – This function estimates any unspecified normal and tangent information. For example, unspecified normals can be estimated from tangents, and tangents can be estimated from normals with some additional assumptions.
This function estimates the vectors in the following order:
1. Normalize all specified normals to length 1
2. Normalize all specified tangents to length 1
3. If edge tangent not specified and normal is specified, estimate edge tangent from normal as the vector perpendicular to the normal in the direction of the straight edge
4. If edge not specified and normal is not specified, estimate edge tangent along linear edge
5. If a normal is not specified, estimate the normal as perpendicular to two edge tangents
6. Scale each tangent by the length of the corresponding straight-edge chord
Subdivide(depth) – This function subdivides a curved triangle into four sub curved-triangles. By recursively calling itself with an argument of depth-1 for each subdivided triangle, this function will produce 4n triangles. When depth equals zero, subdivision terminates and the vertices of the resulting triangles can be used as the final mesh.
HermiteInterpolation(p,v0,v1,t0,t1,n0,n1) – An interpolation function that can interpolate the point v, tangent t, and normal n, at parameter p along a Hermite curve given be two endpoints v0 and v1, two end tangents t0 and t1, and two end normals n0 and n1
--hod
Hod Lipson
Associate Prof. of Mechanical & Aerospace Engineering and Computing & Information Science
Cornell University, 242 Upson Hall, Ithaca NY 14853, USA
Office: (607) 255 1686 Lab: (607) 254 8940 Fax: (607) 255 1222
Email: Hod.L...@cornell.edu
Web: http://www.mae.cornell.edu/lipson
Administrative Assistant: Joe Rogan jfr...@cornell.edu, (607) 255-6981, Upson 260
--
You received this message because you are subscribed to the Google Groups "STL 2.0" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/stl2/-/7OT7yRiQX8AJ.
To post to this group, send email to st...@googlegroups.com.
To unsubscribe from this group, send email to
stl2+uns...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/stl2?hl=en.
To unsubscribe from this group, send email to stl2+un...@googlegroups.com.
Glad you found a solution.
Can you explain what question you had was not covered by the instructions below? I would like to include these instructions in version 1.2 of the format, so let me know how they can be improved.
--hod
Hod Lipson
Associate Prof. of Mechanical & Aerospace Engineering and Computing & Information Science
Cornell University, 242 Upson Hall, Ithaca NY 14853, USA
Office: (607) 255 1686 Lab: (607) 254 8940 Fax: (607) 255 1222
Email: Hod.L...@cornell.edu
Administrative Assistant: Craig Ryan, cd...@cornell.edu (607) 255-0992, Upson 258
1. Hermit interpolation allows easy calculation of mid-point coordinates and tangent direction. However the ppt is silent about recommended approach to compute the normal at edge mid-point. Is averaging normals at end points with subsequent division by the length of result considered to be adequate?
2. In case when edge directions are given and therefore there is no normals information in the file (or normals should be ignored) subdivision necessitates computing surface normals for each triangle sharing the edge. I assume that it is done using data related to edges of these triangles but what are the specifics of the recommended approach?
The answers to these two questions become important if there is a need to perform more than one level of subdivision. I could come up with my own answers to these and similar questions but it would be nice to know the official recommendations without having to pay for F2915 spec on ASTM web site.
Thanks,
- LR
--
You received this message because you are subscribed to the Google Groups "STL 2.0" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/stl2/-/7OT7yRiQX8AJ.
To post to this group, send email to st...@googlegroups.com.
To unsubscribe from this group, send email to
stl2+un...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/stl2?hl=en.
--
You received this message because you are subscribed to the Google Groups "STL 2.0" group.
To view this discussion on the web visit https://groups.google.com/d/msg/stl2/-/ozhxGo9MDLMJ.
To post to this group, send email to st...@googlegroups.com.
To unsubscribe from this group, send email to stl2+uns...@googlegroups.com.
Can you explain what question you had was not covered by the instructions below? I would like to include these instructions in version 1.2 of the format, so let me know how they can be improved.
Sent: Saturday, January 12, 2013 4:43 PM
To: st...@googlegroups.com
Subject: Re: Details of subdivision algorithm.
Even though I could not figure out answers to my questions from your post I did find them by reading Jon Hiller's code.
--
You received this message because you are subscribed to the Google Groups "STL 2.0" group.
To view this discussion on the web visit https://groups.google.com/d/msg/stl2/-/SE5DmExLc7UJ.
--
You received this message because you are subscribed to the Google Groups "STL 2.0" group.
To view this discussion on the web visit https://groups.google.com/d/msg/stl2/-/aUAF9zb-cu0J.