Debian Codegraph @

apps/tools/ivnorm/README

raw
1 This directory contains the source code to the Inventor program
2 `ivnorm'.
3
4 This program attempts to find outward-facing normals for all the
5 SoIndexedFaceSet nodesfound in an Inventor scene file that do not
6 ALREADY have Normal or NormalBinding nodes. It then computes face
7 normals for each face set, inserts them into the database, and writes
8 the result.
9
10 It does not delete existing properties or hierarchy.
11
12 By default, it generates facet normals, and determines the orientation
13 of the polygons itself (the polygons do not have to be oriented
14 consistently).
15
16 To generate normals for other shapes, use 'ivquicken'. However, note
17 that 'ivquicken' assumes that your polygons are already consistently
18 oriented; it will not re-orient them for you (yes, we should merge
19 them, but we never seem to have enough time-- you have the source
20 code, so if you manage to merge them, please send us the source!
21 ([email protected])).
22
23 How to Run
24 ----------
25 ivnorm [-c -C -v -V -a angle] [in_file] [out_file]
26
27 -c : Assume that all polygons are oriented counter-clockwise.
28 -C : Assume that all polygons are oriented clockwise.
29 -v : Find vertex normals (default is face normals).
30 -V : Be verbose; prints messages as it works.
31 -a angle : Use the given angle (given in degrees) as the "crease
32 angle". If vertex normals are being generated and the
33 angle between two faces is greater than this angle, two
34 different normals will generated, creating a sharp crease.
35 Default is 30 degrees.
36
37 It may be given 0, 1, or 2 filename arguments. With 0 arguments, it
38 will read from standard input and write to standard output. With 1
39 argument, it will read from the specified file and write to standard
40 output. With 2 filenames, it will read from the first file and write
41 to the second.
42
43
44 Examples:
45 --------
46 ivnorm foo.iv fooWithNormals.iv
47
48 yourProgram myfile.other | ivnorm -C > myfile.iv
49
50
51 Algorithm to attempt to find outward-facing normals:
52 ---------------------------------------------------
53 First, mark all faces as UNKNOWN.
54
55 Then create an edge dictionary that allows you to find all of the
56 faces sharing a given edge (where an edge is two integers representing
57 the two shared vertices).
58
59 Pick an arbitrary face and mark it COUNTER_CLOCKWISE. Using the edge
60 dictionary, orient all surrounding faces based on the orientation of
61 this face. And recurse for all surrounding faces, consistently
62 orienting the entire surface.
63
64 Find the average of the vertices in this surface. Using that point,
65 calculate a volume measurement, taking into account the face's
66 orientation. If the volume turns out to be positive, assume the faces
67 are oriented correctly. If it is negative, reverse their orientations.
68
69 If any faces are still UNKNOWN after this, choose another direction
70 and go through the algorithm again.
71
72 At the end, faces marked CLOCKWISE must have their indices reversed
73 before facet normals are found.