<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>shape.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Mon Oct 14 14:16:38 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>shape.h</h1><div class="fragment"><pre>00001 <font class="comment">//</font> 00002 <font class="comment">// shape.h</font> 00003 <font class="comment">//</font> 00004 <font class="comment">// Copyright (C) 1996 Limit Point Systems, Inc.</font> 00005 <font class="comment">//</font> 00006 <font class="comment">// Author: Curtis Janssen <cljanss@limitpt.com></font> 00007 <font class="comment">// Maintainer: LPS</font> 00008 <font class="comment">//</font> 00009 <font class="comment">// This file is part of the SC Toolkit.</font> 00010 <font class="comment">//</font> 00011 <font class="comment">// The SC Toolkit is free software; you can redistribute it and/or modify</font> 00012 <font class="comment">// it under the terms of the GNU Library General Public License as published by</font> 00013 <font class="comment">// the Free Software Foundation; either version 2, or (at your option)</font> 00014 <font class="comment">// any later version.</font> 00015 <font class="comment">//</font> 00016 <font class="comment">// The SC Toolkit is distributed in the hope that it will be useful,</font> 00017 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00018 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00019 <font class="comment">// GNU Library General Public License for more details.</font> 00020 <font class="comment">//</font> 00021 <font class="comment">// You should have received a copy of the GNU Library General Public License</font> 00022 <font class="comment">// along with the SC Toolkit; see the file COPYING.LIB. If not, write to</font> 00023 <font class="comment">// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.</font> 00024 <font class="comment">//</font> 00025 <font class="comment">// The U.S. Government is granted a limited license as per AL 91-7.</font> 00026 <font class="comment">//</font> 00027 00028 <font class="preprocessor">#ifndef _math_isosurf_shape_h</font> 00029 <font class="preprocessor"></font><font class="preprocessor">#define _math_isosurf_shape_h</font> 00030 <font class="preprocessor"></font> 00031 <font class="preprocessor">#ifdef __GNUC__</font> 00032 <font class="preprocessor"></font><font class="preprocessor">#pragma interface</font> 00033 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00034 <font class="preprocessor"></font> 00035 <font class="preprocessor">#include <math/isosurf/volume.h></font> 00036 <font class="preprocessor">#include <math/scmat/matrix.h></font> 00037 <font class="preprocessor">#include <math/scmat/vector3.h></font> 00038 <font class="preprocessor">#include <util/container/array.h></font> 00039 <font class="preprocessor">#include <util/container/avlset.h></font> 00040 00041 <font class="keyword">namespace </font>sc { 00042 <a name="l00048"></a><a class="code" href="class_sc__Shape.html">00048</a> <font class="keyword">class </font>Shape: <font class="keyword">public</font> Volume { 00049 <font class="keyword">public</font>: 00050 Shape(); 00051 Shape(<font class="keyword">const</font> Ref<KeyVal>&keyval); 00052 <font class="keyword">virtual</font> <font class="keywordtype">double</font> distance_to_surface(<font class="keyword">const</font> SCVector3&r, 00053 SCVector3*grad=0) <font class="keyword">const</font> = 0; 00054 <font class="keyword">virtual</font> <font class="keywordtype">int</font> is_outside(<font class="keyword">const</font> SCVector3&r) <font class="keyword">const</font>; 00055 <font class="keyword">virtual</font> ~Shape(); 00056 <font class="keywordtype">void</font> <a class="code" href="class_sc__Shape.html#a5">compute</a>(); 00057 <font class="keywordtype">void</font> interpolate(<font class="keyword">const</font> SCVector3& p1, 00058 <font class="keyword">const</font> SCVector3& p2, 00059 <font class="keywordtype">double</font> val, 00060 SCVector3& result); 00061 00062 <font class="keywordtype">int</font> <a class="code" href="class_sc__Shape.html#a7">value_implemented</a>() <font class="keyword">const</font>; 00063 }; 00064 00065 00066 00067 <font class="keyword">class </font>SphereShape: <font class="keyword">public</font> Shape { 00068 <font class="keyword">private</font>: 00069 SCVector3 _origin; 00070 <font class="keywordtype">double</font> _radius; 00071 <font class="keyword">public</font>: 00072 SphereShape(<font class="keyword">const</font> SCVector3&,<font class="keywordtype">double</font>); 00073 SphereShape(<font class="keyword">const</font> Ref<KeyVal>&); 00074 SphereShape(<font class="keyword">const</font> SphereShape&); 00075 ~SphereShape(); 00076 <font class="keywordtype">void</font> boundingbox(<font class="keywordtype">double</font> minvalue, <font class="keywordtype">double</font> maxvalue, 00077 SCVector3& p1, SCVector3&p2); 00078 <font class="keywordtype">double</font> radius()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _radius; } 00079 <font class="keyword">const</font> SCVector3& origin()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _origin; } 00080 <font class="keywordtype">double</font> distance_to_surface(<font class="keyword">const</font> SCVector3&r,SCVector3*grad=0) <font class="keyword">const</font>; 00081 <font class="keywordtype">void</font> print(std::ostream&o=ExEnv::out0()) <font class="keyword">const</font>; 00082 00083 <font class="comment">// these are used to update the parameters describing the sphere</font> 00084 <font class="keywordtype">double</font> radius(<font class="keywordtype">double</font> r); 00085 <font class="keyword">const</font> SCVector3& origin(<font class="keyword">const</font> SCVector3& o); 00086 00087 <font class="keywordtype">int</font> gradient_implemented() <font class="keyword">const</font>; 00088 }; 00089 00090 <font class="keyword">inline</font> <font class="keywordtype">double</font> 00091 SphereShape::radius(<font class="keywordtype">double</font> r)<font class="keyword"></font> 00092 <font class="keyword"></font>{ 00093 <a class="code" href="class_sc__Compute.html#a2">obsolete</a>(); 00094 <font class="keywordflow">return</font> _radius = r; 00095 } 00096 00097 <font class="keyword">inline</font> <font class="keyword">const</font> SCVector3& 00098 SphereShape::origin(<font class="keyword">const</font> SCVector3& o)<font class="keyword"></font> 00099 <font class="keyword"></font>{ 00100 <a class="code" href="class_sc__Compute.html#a2">obsolete</a>(); 00101 _origin = o; 00102 <font class="keywordflow">return</font> _origin; 00103 } 00104 00105 <font class="keyword">class </font>UncappedTorusHoleShape: <font class="keyword">public</font> Shape 00106 { 00107 <font class="keyword">private</font>: 00108 SphereShape _s1; 00109 SphereShape _s2; 00110 <font class="keywordtype">double</font> _r; 00111 <font class="keyword">protected</font>: 00112 <font class="keywordtype">void</font> in_plane_sphere(<font class="keyword">const</font> SCVector3& point, 00113 SCVector3& origin) <font class="keyword">const</font>; 00114 UncappedTorusHoleShape(<font class="keywordtype">double</font> r,<font class="keyword">const</font> SphereShape&,<font class="keyword">const</font> SphereShape&); 00115 <font class="keyword">public</font>: 00116 <font class="keyword">static</font> UncappedTorusHoleShape* 00117 newUncappedTorusHoleShape(<font class="keywordtype">double</font> r, 00118 <font class="keyword">const</font> SphereShape&, 00119 <font class="keyword">const</font> SphereShape&); 00120 <font class="keyword">inline</font> ~UncappedTorusHoleShape()<font class="keyword"> </font>{}; 00121 <font class="keyword">inline</font> <font class="keyword">const</font> SphereShape& sphere(<font class="keywordtype">int</font> i)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> (i?_s2:_s1); }; 00122 <font class="keyword">inline</font> <font class="keyword">const</font> SCVector3 A()<font class="keyword"> const </font>{ SCVector3 v(_s1.origin()); <font class="keywordflow">return</font> v; } 00123 <font class="keyword">inline</font> <font class="keyword">const</font> SCVector3 B()<font class="keyword"> const </font>{ SCVector3 v(_s2.origin()); <font class="keywordflow">return</font> v; } 00124 <font class="keyword">inline</font> <font class="keywordtype">double</font> radius()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _r; }; 00125 <font class="keywordtype">void</font> print(std::ostream&o=ExEnv::out0()) <font class="keyword">const</font>; 00126 <font class="keywordtype">void</font> boundingbox(<font class="keywordtype">double</font> valuemin, <font class="keywordtype">double</font> valuemax, 00127 SCVector3& p1, SCVector3&p2); 00128 00129 <font class="keywordtype">int</font> gradient_implemented() <font class="keyword">const</font>; 00130 }; 00131 00132 <font class="keyword">class </font>NonreentrantUncappedTorusHoleShape: <font class="keyword">public</font> UncappedTorusHoleShape 00133 { 00134 <font class="keyword">private</font>: 00135 <font class="keywordtype">double</font> rAP; 00136 <font class="keywordtype">double</font> rBP; 00137 SCVector3 BA; 00138 <font class="keyword">public</font>: 00139 NonreentrantUncappedTorusHoleShape(<font class="keywordtype">double</font> r, 00140 <font class="keyword">const</font> SphereShape&, 00141 <font class="keyword">const</font> SphereShape&); 00142 ~NonreentrantUncappedTorusHoleShape(); 00143 <font class="keywordtype">double</font> distance_to_surface(<font class="keyword">const</font> SCVector3&r,SCVector3*grad=0) <font class="keyword">const</font>; 00144 00145 <font class="keywordtype">int</font> gradient_implemented() <font class="keyword">const</font>; 00146 }; 00147 00148 <font class="keyword">class </font>ReentrantUncappedTorusHoleShape: <font class="keyword">public</font> UncappedTorusHoleShape 00149 { 00150 <font class="keyword">private</font>: 00151 <font class="keywordtype">double</font> rAP; 00152 <font class="keywordtype">double</font> rBP; 00153 SCVector3 BA; 00154 SCVector3 I[2]; <font class="comment">// the intersect points</font> 00155 <font class="keyword">public</font>: 00156 ReentrantUncappedTorusHoleShape(<font class="keywordtype">double</font> r, 00157 <font class="keyword">const</font> SphereShape&, 00158 <font class="keyword">const</font> SphereShape&); 00159 ~ReentrantUncappedTorusHoleShape(); 00160 <font class="keywordtype">int</font> is_outside(<font class="keyword">const</font> SCVector3&r) <font class="keyword">const</font>; 00161 <font class="keywordtype">double</font> distance_to_surface(<font class="keyword">const</font> SCVector3&r,SCVector3*grad=0) <font class="keyword">const</font>; 00162 00163 <font class="keywordtype">int</font> gradient_implemented() <font class="keyword">const</font>; 00164 }; 00165 00166 <font class="keyword">class </font>Uncapped5SphereExclusionShape: <font class="keyword">public</font> Shape 00167 { 00168 <font class="keyword">private</font>: 00169 <font class="keywordtype">int</font> _solution_exists; 00170 <font class="keywordtype">int</font> _reentrant; 00171 <font class="keywordtype">int</font> _folded; 00172 SphereShape _s1; 00173 SphereShape _s2; 00174 SphereShape _s3; 00175 SCVector3 D[2]; 00176 <font class="keywordtype">double</font> BDxCDdotAD[2]; 00177 SCVector3 BDxCD[2]; 00178 <font class="keywordtype">double</font> CDxADdotBD[2]; 00179 SCVector3 CDxAD[2]; 00180 <font class="keywordtype">double</font> ADxBDdotCD[2]; 00181 SCVector3 ADxBD[2]; 00182 <font class="keywordtype">double</font> _r; 00183 00184 <font class="comment">// these are needed for folded shapes</font> 00185 <font class="comment">// F1 and F2 are the two points of A, B, and C that are closed to M</font> 00186 SCVector3 F1; 00187 SCVector3 F2; 00188 00189 <font class="comment">// these are needed for reentrant surfaces to compute distances</font> 00190 SCVector3 M; <font class="comment">// projection of D onto ABC plane</font> 00191 SCVector3 MD[2]; <font class="comment">// M - D </font> 00192 <font class="keywordtype">double</font> theta_intersect; <font class="comment">// angle M - D - intersect_point</font> 00193 <font class="keywordtype">double</font> r_intersect; <font class="comment">// the radius of the intersect circle</font> 00194 <font class="keywordtype">int</font> _intersects_AB; 00195 SCVector3 IABD[2][2]; 00196 <font class="keywordtype">int</font> _intersects_BC; 00197 SCVector3 IBCD[2][2]; 00198 <font class="keywordtype">int</font> _intersects_CA; 00199 SCVector3 ICAD[2][2]; 00200 00201 <font class="keyword">protected</font>: 00202 Uncapped5SphereExclusionShape(<font class="keywordtype">double</font> r, 00203 <font class="keyword">const</font> SphereShape&, 00204 <font class="keyword">const</font> SphereShape&, 00205 <font class="keyword">const</font> SphereShape&); 00206 <font class="keyword">public</font>: 00207 <font class="keyword">static</font> Uncapped5SphereExclusionShape* 00208 newUncapped5SphereExclusionShape(<font class="keywordtype">double</font> r, 00209 <font class="keyword">const</font> SphereShape&, 00210 <font class="keyword">const</font> SphereShape&, 00211 <font class="keyword">const</font> SphereShape&); 00212 <font class="keyword">inline</font> ~Uncapped5SphereExclusionShape()<font class="keyword"> </font>{}; 00213 <font class="keyword">inline</font> <font class="keyword">const</font> SCVector3 A()<font class="keyword"> const </font>{ SCVector3 v(_s1.origin()); <font class="keywordflow">return</font> v; } 00214 <font class="keyword">inline</font> <font class="keyword">const</font> SCVector3 B()<font class="keyword"> const </font>{ SCVector3 v(_s2.origin()); <font class="keywordflow">return</font> v; } 00215 <font class="keyword">inline</font> <font class="keyword">const</font> SCVector3 C()<font class="keyword"> const </font>{ SCVector3 v(_s3.origin()); <font class="keywordflow">return</font> v; } 00216 <font class="keyword">inline</font> <font class="keywordtype">double</font> rA()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _s1.radius(); }; 00217 <font class="keyword">inline</font> <font class="keywordtype">double</font> rB()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _s2.radius(); }; 00218 <font class="keyword">inline</font> <font class="keywordtype">double</font> rC()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _s3.radius(); }; 00219 <font class="keyword">inline</font> <font class="keywordtype">double</font> r()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _r; }; 00220 <font class="keyword">inline</font> <font class="keywordtype">int</font> solution_exists()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _solution_exists; }; 00221 <font class="keywordtype">double</font> distance_to_surface(<font class="keyword">const</font> SCVector3&r,SCVector3*grad=0) <font class="keyword">const</font>; 00222 <font class="keywordtype">int</font> is_outside(<font class="keyword">const</font> SCVector3&) <font class="keyword">const</font>; 00223 <font class="keywordtype">void</font> boundingbox(<font class="keywordtype">double</font> valuemin, <font class="keywordtype">double</font> valuemax, 00224 SCVector3& p1, SCVector3&p2); 00225 00226 <font class="keywordtype">int</font> gradient_implemented() <font class="keyword">const</font>; 00227 }; 00228 <a name="l00230"></a><a class="code" href="class_sc__UnionShape.html">00230</a> <font class="keyword">class </font>UnionShape: <font class="keyword">public</font> Shape { 00231 <font class="keyword">protected</font>: 00232 AVLSet<Ref<Shape> > _shapes; 00233 <font class="keyword">public</font>: 00234 <font class="keywordtype">void</font> add_shape(Ref<Shape>); 00235 UnionShape(); 00236 ~UnionShape(); 00237 <font class="keywordtype">double</font> distance_to_surface(<font class="keyword">const</font> SCVector3&r,SCVector3*grad=0) <font class="keyword">const</font>; 00238 <font class="keywordtype">int</font> is_outside(<font class="keyword">const</font> SCVector3&r) <font class="keyword">const</font>; 00239 <font class="keywordtype">void</font> boundingbox(<font class="keywordtype">double</font> valuemin, <font class="keywordtype">double</font> valuemax, 00240 SCVector3& p1, SCVector3& p2); 00241 00242 <font class="keywordtype">int</font> gradient_implemented() <font class="keyword">const</font>; 00243 }; 00244 00245 } 00246 00247 <font class="preprocessor">#endif</font> 00248 <font class="preprocessor"></font> 00249 <font class="comment">// Local Variables:</font> 00250 <font class="comment">// mode: c++</font> 00251 <font class="comment">// c-file-style: "CLJ"</font> 00252 <font class="comment">// End:</font> </div></pre><hr> <address> <small> Generated at Mon Oct 14 14:16:38 2002 for <a href="http://aros.ca.sandia.gov/~cljanss/mpqc">MPQC</a> 2.1.2 using the documentation package <a href="http://www.stack.nl/~dimitri/doxygen/index.html">Doxygen</a> 1.2.5. </small> </address> </body> </html>