generate triangular mesh
TRANSCRIPT
-
8/13/2019 Generate triangular mesh
1/15
CSE325Computer Science
and Sculpture
Prof. George Hart
-
8/13/2019 Generate triangular mesh
2/15
Triangulated Surfaces
Any 3D form (polyhedral or curved) can beapproximated by a triangulated surface.
Polygons of 4 or more sides can be dividedinto triangles.
On a computer these are represented by
listing the three corners for each triangle. A corner (a vertex) is described by XYZ
coordinates
-
8/13/2019 Generate triangular mesh
3/15
Many Triangles Allow Detail
-
8/13/2019 Generate triangular mesh
4/15
Polygons Divide into Triangles
An n-gon is represented as n-2 triangles
4 sides2 5 sides3 8 sides6
-
8/13/2019 Generate triangular mesh
5/15
Triangles in Space
Each vertex has (X, Y, Z)coordinates
List vertices starting with
any of the three
List counter-clockwise as
seen from outside
Normal vector points
out from object Use Right-handed XYZ
axes
Triangle:(0,0,0) (0,1,0) (0,0,1)
Or:(0,1,0) (0,0,1) (0,0,0)
Or:(0,0,1) (0,0,0) (0,1,0)
-
8/13/2019 Generate triangular mesh
6/15
Right-Handed Coordinate System
-
8/13/2019 Generate triangular mesh
7/15
Example Tetrahedron
A: (1 1 1) (-1 -1 1) (1 -1 -1) B: (-1 -1 1) (-1 1 -1) (1 -1 -1)
C: (1 1 1) (1 -1 -1) (-1 1 -1) D: (1 1 1) (-1 1 -1) (-1 -1 1)
-
8/13/2019 Generate triangular mesh
8/15
Many 3D File Formats Exist 3ds 3D Studio Binary
cob Caligari objects scn Caligari
lwo, lw LightWave
obj Alias WaveFront objects
objf Stripe objf file format
off Object file format
geo AOFF File Format
raw RAW File Format
rax RAX File Format
x Direct X
wrl VRML
c4d Cinema 4D
3dm, 3dmf 3DMax
iob Imaginedxf, dxb AutoCAD DXF
3dm Rhinoceros
pro Power Render
mts Metastream fileflt OpenFlight
ase 3D Studio MAX
dwg AutoCAD DWG
ndoNendo
si SOFTIMAGE
spx SPX file format
peo, geo Homeworld
stl Stereolithography
-
8/13/2019 Generate triangular mesh
9/15
Note: We will Simplify A Lot
Different 3D formats contain many differentways of describing not just triangles but alsopolygons, curves, colors, textures, images,
lights, cameras, animation, hierarchicalstructure, annotations, compression, and morethat is very useful in rendering images.
Well ignore all that and just look at triangles
Triangles are sufficient for describing form
-
8/13/2019 Generate triangular mesh
10/15
stlFile Format
You can create an ASCIIstlfile in any texteditor, e.g., wordor wordpad
Then view it in any 3D viewing program.
Usually a 3D design program (e.g.,Maya)is used to create/modify/view the file, butwe will make files with a text editor as anexercise to understand the process.
Thestlfile can then be given to a solidfreeform fabrication machine to have yourform physically created.
-
8/13/2019 Generate triangular mesh
11/15
stlFile Format
Create file in any text editor
Write a start line, an end line, and agroup of 7 lines for each triangle.
Triangles can be listed in any order.
solid
endsolid
-
8/13/2019 Generate triangular mesh
12/15
stlFile Format
For each triangle give 7 lines:facet normal 0 0 0
outer loop
vertex X Y Z
vertex X Y Z
vertex X Y Zendloop
endfacet
Only the X Y Z parts need to change for
each triangle (Some programs need the normal)
Easy to copy and paste in editor
-
8/13/2019 Generate triangular mesh
13/15
ExamplestlFile Format (ASCII)solid tetrahedron
facet normal 0 0 0outer loop
vertex 1 1 1
vertex 1 -1 -1
vertex -1 1 -1
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 1 1 1vertex -1 1 -1
vertex -1 -1 1
endloop
endfacet
facet normal 0 0 0
outer loopvertex 1 1 1
vertex -1 -1 1
vertex 1 -1 -1
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -1 1 -1
vertex 1 -1 -1vertex -1 -1 1
endloop
endfacet
endsolid tetrahedron
-
8/13/2019 Generate triangular mesh
14/15
Lab exercise
Design an object (a pyramid; then an icosahedron)
determine coordinates of vertices
determine triangles
Create .stlfile in editor
Save it with new name, e.g.,pyramid.stl
Paste in start line, group of 7 lines, and end line
Edit it to have enough groups of 7 lines
Edit each group to have the three XYZs for onetriangle
View it in 3D viewing program
Find any problems and edit file to fix them
-
8/13/2019 Generate triangular mesh
15/15
Demo
Creatingstlfile
Editing file
Viewing file Possible errors:
Incorrect formatting
Unmatched edges
Backwards-facing faces