"Universal Solids" library
Notes - version 1.5.1, 25 May 2011 @15:45 CEST+
Editors: J. Apostolakis, G. Cosmo
Contributors: J. Apostolakis, G. Cosmo, A. Gheata, Astrid M., T. Nikitina

- API: generic constructor for "cut"-solids, different implementations/classes for each case.
          backwards compatibility in constructors API.

Foundations:
- Independent Vector 'bucket' struct/class - no functionality beyond passing values of x,y,z components
- Tolerance defines the half-thickness of the surface, must be a global value.  Once it is set, the tolerance cannot be changed (so it is Write Once, Read Many times-=WORM). Eventually it will be set based on the value of the "world" diameter.)
- SetUnitLength( std::string NameOfUnit );
- GetUnitLength() returns std::string
  (TODO: integrate into a specialized class/singleton.)


VUSolid's Main methods

- EInside Inside (point-vector) const
  o returns enum {In, Out, Surface}

- double SafetyFromIn    (point-vector, bool accurate=false) const
  double SafetyFromOut (point-vector, bool accurate=false) const
  o return approximated distance (double) from a surface
  o must be fast, can think to provide also a "precise" version, at the cost of performance (to be investigated)
  o should be optimized for big distances

- double DistanceToIn(point-vector, direction-vector) const
  double DistanceToOut(point-vector, direction-vector, &normal-vector, &bool convex) const
  o return the exact distance (double) from a surface, given a direction
  o compute the normal on the surface, returned as argument, calculated
     within the method to verify if it is close to the surface or not
  o for DistanceToOut(), normal-vector and convexity flag are mandatory:
     If 'convex' is 'true' then the solid is fully behind it, (call it "convex at this point")
     If 'convex' is 'false' either the solid extends beyond this plane or it could not guarantee otherwise.
  o for DistanceToIn(), the normal-vector could be added as optional

- bool ComputeNormal(point-vector, &direction-vector) const
  o computes the normal on a surface and returns it as a direction vector
  o should return a valid vector also in case the point is not on the surface, for safety
  o should treat cases on corners, to avoid returning invalid normal
  o return argument, a Boolean as validity flag

- void Extent(EAxis, &min, &max) const
  o returns the minimum and maximum extent along the specified Cartesian axis
  o expect it to use internally a GetBBox()/CalculateBBox() method to compute the extent
Decision: whether to store the computed BBox (containing or representing 6 double values), and whether to compute it at construction time  
  Note: thread-safety is an issue in parameterised volumes - where the dimension can change at runtime). 
  Implementation Issue: The bounding-box can be an auxiliary class/bucket used by each solid.


VUSolid's Auxiliary methods

- double Capacity();   // was CubicVolume()

- double SurfaceArea()

- point-vector SamplePointOnSurface() const

- point-vector SamplePointInVolume() const

- point-vector SamplePointOnEdges() const
  o generates points on the edges of a solid - primarily for testing purposes
  o for solids composed only of curved surfaces(like full spheres or toruses) or where an implementation is not available, it defaults to PointOnSurface.

- VUSolid* Clone() const
  o provide a new object which is a clone of the solid
  
- ComputeMesh() - for visualization NOT discussed

// The definitive version of the interface is in the VUSolid class interface,
//  currently at /afs/cern.ch/user/j/japost/public/VuSolid.hh

Open issues

     Does the adoption of the mathematical answer matter at all? For Boolean operations? Need to investigate further.
Implementation details

Tests

- Additional tests may apply for curved solids for local angular tolerances, by computing the error against the real computed value
- Should standardize on the output of the tests in order to be able to visualize them with a single program.


Todos:
Notes for the meeting on June 7 (John, Andrei, Gabiele, Tatiana)