1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3//EN">
2<HTML><HEAD>
3		<TITLE>User's Reference - SimplifySurface</TITLE>
4		<META HTTP-EQUIV="keywords" CONTENT="GRAPHICS VISUALIZATION VISUAL PROGRAM DATA
5MINING">
6	<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
7</HEAD><BODY BGCOLOR="#FFFFFF" link="#00004b" vlink="#4b004b">
8		<TABLE width=510 border=0 cellpadding=0 cellspacing=0>
9			<TR>
10				<TD><IMG src="../images/spacer.gif" width=80 height=1></TD>
11				<TD><IMG src="../images/spacer.gif" width=49 height=1></TD>
12				<TD><IMG src="../images/spacer.gif" width=24 height=1></TD>
13				<TD><IMG src="../images/spacer.gif" width=100 height=1></TD>
14				<TD><IMG src="../images/spacer.gif" width=3 height=1></TD>
15				<TD><IMG src="../images/spacer.gif" width=127 height=1></TD>
16				<TD><IMG src="../images/spacer.gif" width=6 height=1></TD>
17				<TD><IMG src="../images/spacer.gif" width=50 height=1></TD>
18				<TD><IMG src="../images/spacer.gif" width=71 height=1></TD>
19			</TR>
20			<TR>
21				<TD colspan=9><IMG src="../images/flcgh_01.gif" width=510 height=24 alt="OpenDX - Documentation"></TD>
22			</TR>
23			<TR>
24				<TD colspan=2><A href="../allguide.htm"><IMG src="../images/flcgh_02.gif" width=129 height=25 border="0" alt="Full Contents"></A></TD>
25				<TD colspan=3><A href="../qikguide.htm"><IMG src="../images/flcgh_03.gif" width=127 height=25 border="0" alt="QuickStart Guide"></A></TD>
26				<TD><A href="../usrguide.htm"><IMG src="../images/flcgh_04.gif" width=127 height=25 border="0" alt="User's Guide"></A></TD>
27				<TD colspan=3><B><A href="../refguide.htm"><IMG src="../images/flcgh_05d.gif" width=127 height=25 border="0" alt="User's Reference"></A></B></TD>
28			</TR>
29			<TR>
30				<TD><A href="refgu141.htm"><IMG src="../images/flcgh_06.gif" width=80 height=17 border="0" alt="Previous Page"></A></TD>
31				<TD colspan=2><A href="refgu143.htm"><IMG src="../images/flcgh_07.gif" width=73 height=17 border="0" alt="Next Page"></A></TD>
32				<TD><A href="../refguide.htm"><IMG src="../images/flcgh_08.gif" width=100 height=17 border="0" alt="Table of Contents"></A></TD>
33				<TD colspan=3><A href="refgu009.htm"><IMG src="../images/flcgh_09.gif" width=136 height=17 border="0" alt="Partial Table of Contents"></A></TD>
34				<TD><A href="refgu175.htm"><IMG src="../images/flcgh_10.gif" width=50 height=17 border="0" alt="Index"></A></TD>
35				<TD><A href="../srchindx.htm"><IMG src="../images/flcgh_11.gif" width=71 height=17 border="0" alt="Search"></A></TD>
36			</TR>
37		</TABLE>
38		<H3><A name="HDRSIMPSUR" ></A>SimplifySurface</H3>
39		<P><STRONG>Category</STRONG>
40		<P>
41<A HREF="refgu008.htm#HDRCATTRN">Transformation</A>
42<P><STRONG>Function</STRONG>
43<P>
44Simplifies a triangulated surface and resamples data attached to the surface.
45<P><STRONG>Syntax</STRONG>
46<PRE>
47<STRONG>simplified</STRONG> = SimplifySurface(<STRONG>original_surface, max_error, max_data_error,
48                             volume, boundary, length, data, stats</STRONG>);
49</PRE>
50<P><STRONG>Inputs</STRONG>
51<BR>
52<TABLE BORDER>
53<TR>
54<TH ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">Name
55</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">Type
56</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">Default
57</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">Description
58</TH></TR><TR>
59<TD ALIGN="LEFT" VALIGN="TOP"
60WIDTH="20%"><TT><STRONG>original_surface</STRONG></TT>
61</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">field
62</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">(none)
63</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">triangulated surface
64</TD></TR><TR>
65<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>max_error</STRONG></TT>
66</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">scalar
67</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">input dependent
68</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">maximum positional error
69</TD></TR><TR>
70<TD ALIGN="LEFT" VALIGN="TOP"
71WIDTH="20%"><TT><STRONG>max_data_error</STRONG></TT>
72</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">scalar
73</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">input dependent
74</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">maximum data error
75</TD></TR><TR>
76<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>volume</STRONG></TT>
77</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">flag
78</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">1
79</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">1: move vertices to preserve
80volume
81<BR>
820: do not move vertices
83</TD></TR><TR>
84<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>boundary</STRONG></TT>
85</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">flag
86</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">0
87</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">1: simplify surface boundaries
88<BR>
890: do not simplify surface boundaries
90</TD></TR><TR>
91<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>length</STRONG></TT>
92</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">flag
93</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">1
94</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">1: move vertices to preserve the
95length of boundaries
96<BR>
970: do not move vertices
98</TD></TR><TR>
99<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>data</STRONG></TT>
100</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">flag
101</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">1
102</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">1: use data dependent on
103"positions" to constrain simplification
104<BR>
1050: ignore data for simplification
106</TD></TR><TR>
107<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%"><TT><STRONG>stats</STRONG></TT>
108</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">flag
109</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="20%">0
110</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="40%">1: provide simple statistics.
111<BR>
1120: do not provide statistics
113</TD></TR></TABLE>
114<P><STRONG>Outputs</STRONG>
115<BR>
116<TABLE BORDER>
117<TR>
118<TH ALIGN="LEFT" VALIGN="TOP" WIDTH="25%">Name
119</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="25%">Type
120</TH><TH ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">Description
121</TH></TR><TR>
122<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="25%"><TT><STRONG>simplified</STRONG></TT>
123</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="25%">field
124</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH="50%">simplified triangulated surface
125</TD></TR></TABLE>
126<P><STRONG>Functional Details</STRONG>
127<P>
128SimplifySurface builds a <TT><STRONG>simplified</STRONG></TT> surface that is
129guaranteed to deviate from <TT><STRONG>original_surface</STRONG></TT> by less
130than <TT><STRONG>max_error</STRONG></TT>. This means that each vertex of
131<TT><STRONG>simplified</STRONG></TT> as well as each point inside a triangle
132of <TT><STRONG>simplified</STRONG></TT> is at a Euclidean
133distance no further than
134<TT><STRONG>max_error</STRONG></TT> from
135<TT><STRONG>original_surface</STRONG></TT>.
136Similarly, each vertex of <TT><STRONG>original_surface</STRONG></TT> as well
137as each point inside a triangle of <TT><STRONG>original_surface</STRONG></TT>
138is at a distance no further than <TT><STRONG>max_error</STRONG></TT> from the
139simplified surface.
140<P>
141In addition, if a "data" component of
142<TT><STRONG>original_surface</STRONG></TT> is dependent on the
143"positions" component and is not <TT><STRONG>TYPE_STRING</STRONG></TT>,
144SimplifySurface will perform a data dependent simplification:
145SimplifySurface will resample "data" on the simplified surface and
146guarantee that the maximum deviation between the original and re-sampled
147data is less than <TT><STRONG>max_error_data</STRONG></TT>. For efficiency
148reasons, the dimensionality of the "data" component is currently
149limited to 3: for instance, it will work for RGB colors or for gradient
150values in 3-dimension.
151Note that data dependent on connections will <B>not</B> constrain
152simplification.
153<P>
154Vertex normals for the <TT><STRONG>simplified</STRONG></TT> surface are
155automatically computed.
156<P>
157Components dependent on "positions" or "connections" of
158<TT><STRONG>original_surface</STRONG></TT> are added to
159<TT><STRONG>simplified</STRONG></TT> and re-sampled. For components dependent
160on "connections", the triangle areas are used to weight the
161resampling.
162<P>
163The following components are not re-sampled: "positions",
164"connections", "invalid positions", "invalid
165connections" "normals", "neighbors", and
166"positional error".
167<TABLE CELLPADDING="3">
168<TR VALIGN="TOP"><TD><P><B><TT><STRONG>original_surface</STRONG></TT>
169</B></TD><TD><P>must have triangular connections.
170<TT><STRONG>original_surface</STRONG></TT> is the field that is being
171simplified.
172</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>max_error</STRONG></TT>
173</B></TD><TD><P>maximum distance
174(in the units of the "position" component)
175between <TT><STRONG>simplified</STRONG></TT> and
176<TT><STRONG>original_surface</STRONG></TT>. The default value for
177<TT><STRONG>max_error</STRONG></TT> is 1% of the diagonal of the bounding box
178of <TT><STRONG>original_surface</STRONG></TT>. You may decide to set
179<TT><STRONG>max_error</STRONG></TT> to a lower or higher value than the
180default.
181</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>max_data_error</STRONG></TT>
182</B></TD><TD><P>maximum deviation between data attached to
183<TT><STRONG>original_surface</STRONG></TT> vertices, and the resampling of
184that data on the <TT><STRONG>simplified</STRONG></TT> surface. (Again the
185maximum deviation also holds for points inside triangles, not just
186vertices).
187<P>
188The default value for the maximum error on the data is set to 10% of the
189diagonal of the bounding box in data space. If the data is one
190dimensional, the default error is (max_data-min_data)/10.
191<P>
192<TT><STRONG>max_data_error</STRONG></TT> is ignored if
193<TT><STRONG>data</STRONG></TT> = 0 or if the data are connection-dependent.
194</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>volume</STRONG></TT>
195</B></TD><TD><P>specifies whether the volume enclosed by the surface should be
196preserved or not. If set to 1, SimplifySurface will
197move the surface vertices in order to preserve the volume while the
198number of vertices is being reduced. In this case, the volume is
199preserved to within floating point or higher accuracy. If set to 0,
200the surface vertices will not be moved. The default is 1.
201<P>
202The volume is only truly defined for a surface that does not have a
203boundary (closed surface). Setting
204<TT><STRONG>volume</STRONG></TT> to 1 on a surface with boundary will have the
205effect of preventing shrinkage and producing more regular triangles.
206<P>
207Note that if several surfaces share the same boundary, as when
208Isosurface is used on partitioned data, the volume can still be
209preserved with <TT><STRONG>volume</STRONG></TT> set to 1 if the boundary is
210left intact (<TT><STRONG>boundary</STRONG></TT> set to 0).
211<P>
212With surfaces that present sharp angles, such as CAD data, setting
213<TT><STRONG>volume</STRONG></TT> to 1 might not work well. In general, we
214recommend setting <TT><STRONG>volume</STRONG></TT> to zero when operating on
215CAD data.
216</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>boundary</STRONG></TT>
217</B></TD><TD><P>specifies whether the boundary of a surface should be simplified
218or
219left intact. If set to 1, then the boundary is
220simplified while respecting the same errors
221<TT><STRONG>max_error</STRONG></TT> and
222<TT><STRONG>max_data_error</STRONG></TT>. If
223set to 0, then the boundary is left intact. The
224default is 0. If <TT><STRONG>original_surface</STRONG></TT> has no boundary,
225this option is ignored.
226</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>length</STRONG></TT>
227</B></TD><TD><P>if <TT><STRONG>boundary</STRONG></TT> set
228to 1, specifies whether the length of the simplified boundary should be
229preserved. If set to 1, in a manner analogous to
230volume preservation, SimplifySurface will move the boundary vertices in
231order to preserve the boundary length while the number of boundary
232vertices is being reduced. If set to 0, the boundary
233vertices will not be moved. The default is 1. If
234<TT><STRONG>boundary</STRONG></TT> is set to 0 then the value of
235<TT><STRONG>length</STRONG></TT> is ignored.
236</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>data</STRONG></TT>
237</B></TD><TD><P>if set to 1, instructs SimplifySurface
238use <TT><STRONG>max_data_error</STRONG></TT> to constrain simplification if
239data are dependent on "positions" and are not
240<TT><STRONG>TYPE_STRING</STRONG></TT>, and if the dimensionality of such
241data is 3 or lower. If set to 0, simplification will not be constrained
242by data. In any case, SimplifySurface will resample
243data after simplification.
244The default is 1.
245</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>stats</STRONG></TT>
246</B></TD><TD><P>if set to 1, instructs SimplifySurface to write simple
247statistics:
248number of vertices and triangles in original_surface, number of vertices
249and triangles in simplified, and percentage of original numbers of
250vertices and triangles. This information will appear in the Message window.
251If set to 0, SimplifySurface will not provide
252statistics. The default is 0.
253</TD></TR><TR VALIGN="TOP"><TD><P><B><TT><STRONG>simplified</STRONG></TT>
254</B></TD><TD><P>simplified surface.
255</TD></TR></TABLE>
256<P>
257<H4><A NAME="HDRLOD">Generating surface levels of detail.</A></H4>
258<P>SimplifySurface adds a "positional error" component  to the
259<TT><STRONG>simplified</STRONG></TT> surface. "positional error"
260is a component dependent on "positions" that provides for each
261vertex of <TT><STRONG>simplified</STRONG></TT> a positive number. This
262positive number, the error value, represents
263the radius of a sphere centered on the vertex, that is guaranteed to
264intersect the original surface. The union of such spheres represents the
265error volume of the simplified surface, which is guaranteed to enclose
266the original surface. Points inside triangles are assigned an error
267value that is interpolated from the error values at the triangle
268vertices using barycentric coordinates.
269<P>
270Using the "positional error" component, a simplified surface can be
271re-simplified to any <TT><STRONG>max_error</STRONG></TT> while still
272guaranteeing a bound with respect to the original surface. This is
273useful for generating successive levels of detail.
274<P>
275If the same error bound is used, a marginal additional simplification
276can be observed: the algorithm implements a greedy method, and does not
277guarantee to find the minimum number of triangles that respects a given
278error bound.
279<P>
280The use of the "positional error" component by SimplifySurface is
281transparent to you, but you may occasionally want to visualize the
282simplification error, using the Mark module. An example is provided in
283SimplifySurface.net.
284<P><STRONG>Components</STRONG>
285<P>
286SimplifySurface adds a "positional error" component that is dependent
287on "positions" (see <A HREF="#HDRLOD">"Generating surface levels of
288detail."</A>).
289<P>
290In general <TT><STRONG>simplified</STRONG></TT> has the same components as
291<TT><STRONG>original_surface</STRONG></TT> except for "invalid positions",
292"invalid connections", "neighbors", and components that are
293<TT><STRONG>TYPE_STRING</STRONG></TT>.
294<P><STRONG>Example Visual Programs</STRONG>
295<PRE>
296SimplifySurface.net
297</PRE>
298<P><STRONG>See Also</STRONG>
299<P>
300<A HREF="refgu114.htm#HDRREFINE">Refine</A>,
301<A HREF="refgu113.htm#HDRREDUCE">Reduce</A>,
302<A HREF="refgu081.htm#HDRISOSURF">Isosurface</A>,
303<A HREF="refgu091.htm#HDRMAP">Map</A>
304		<P>
305		<HR>
306		<DIV align="center">
307			<P><A href="../allguide.htm"><IMG src="../images/foot-fc.gif" width="94" height="18" border="0" alt="Full Contents"></A> <A href="../qikguide.htm"><IMG src="../images/foot-qs.gif" width="94" height="18" border="0" alt="QuickStart Guide"></A> <A href="../usrguide.htm"><IMG src="../images/foot-ug.gif" width="94" height="18" border="0" alt="User's Guide"></A> <A href="../refguide.htm"><IMG src="../images/foot-ur.gif" width="94" height="18" border="0" alt="User's Reference"></A></P>
308		</DIV>
309		<DIV align="center">
310			<P><FONT size="-1">[ <A href="http://www.research.ibm.com/dx">OpenDX Home at IBM</A>&nbsp;|&nbsp;<A href="http://www.opendx.org/">OpenDX.org</A>&nbsp;] </FONT></P>
311			<P></P>
312		</DIV>
313		<P></P>
314	</BODY></HTML>
315