Why are triangles always used for drawing surfaces in 3D? Why not a square or some other shape?
相关问题
- Is GLFW designed to use without LWJGL (in java)?
- How does gl_ClipVertex work relative to gl_ClipDis
- Incorrect Clipping and 3D Projection when using Sl
- Create depth map from 3d points
- Is clipping done automatically in Three.js?
相关文章
- Algorithm for partially filling a polygonal mesh
- Robust polygon normal calculation
- Keep constant number of visible circles in 3D anim
- How do I remove axis from a rotation matrix?
- How to smooth the blocks of a 3D voxel world?
- Mayavi: rotate around y axis
- Using 3d Carousel project to create SPB Carousel s
- Check a face is upwards/downwards towards mouse di
Triangles can never be non-planar; anything with more than 3 points can be non-planar and thus un-renderable unless converted to triangles.
For example: A square is two triangles that are on the same plane, if all the points that make up the square are co-planar. It takes a lot of calculations to make sure all the points are co-planar, thus all polygons that are greater than 3 points are pre-calculated by decimating them into triangles and tested to make sure all the points are co-planar once, instead of on every frame that gets rendered.
Here is good reference about polygon meshes.
Planar Mesh
http://softimage.wiki.softimage.com/xsidocs/ca0c8514.jpg
Non-Planar Mesh
http://softimage.wiki.softimage.com/xsidocs/ca0c854b.jpg
and one more example that might make it clearer
http://download.autodesk.com/us/maya/2010help/images/MED/Stargate/English/Poly/comp_poly_customwarpeg.png
The non-planar mesh is degenerate and can't be sorted or rendered correctly in any sane manner. Triangles don't have this problem.
Efficiency
Triangles also are very memory efficient and can be sorted, and rendered extremely fast when using Triangle Strips which only need 1 point to be stored for each additional triangle after the first.
http://upload.wikimedia.org/wikipedia/en/0/03/Triangle_Strip.png
and Triangle Fans which is a special case of a Triangle Strip.
http://www.codesampler.com/d3dbook/chapter_05/chapter_05_files/image008.jpg
Since 3 points are the minimum necessary to define a planar surface any shape can be simulated using many triangles, and efficient algorithms exist to rapidly paint triangles onto the screen.
Basically any complex (surface) structure can be represented as a bunch of triangles. The triangle is the most atomic and primitive geometry. Hence it is used as base for almost anything. Nevertheless most 3D engines provide you with more complex primitives like spheres, cones, cylinders, donuts, whatnot. Check your libraries documentation.