/***************************************************************************
 *   Copyright (C) 2004 - 2005 by Raphael Langerhorst                      *
 *   raphael-langerhorst@gmx.at                                            *
 *                                                                         *
 *   Permission is hereby granted, free of charge, to any person obtaining *
 *   a copy of this software and associated documentation files (the       *
 *   "Software"), to deal in the Software without restriction, including   *
 *   without limitation the rights to use, copy, modify, merge, publish,   *
 *   distribute, sublicense, and/or sell copies of the Software, and to    *
 *   permit persons to whom the Software is furnished to do so, subject to *
 *   the following conditions:                                             *
 *                                                                         *
 *   The above copyright notice and this permission notice shall be        *
 *   included in all copies or substantial portions of the Software.       *
 *                                                                         *
 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
 *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
 *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
 *   OTHER DEALINGS IN THE SOFTWARE.                                       *
 ***************************************************************************/

#ifndef GFORMH
#define GFORMH

#include "GVector3.h"

#include <qmutex.h>

namespace GCS
{

/**
  \class GForm GForm.h
  \brief Defines the geometry of an element
  @author Raphael Langerhorst
  
  GForm represents the form of an object. This includes all kinds of
  geometric figures like spheres, boxes, cylinders, pyramides, ...

  Note that in GForm only parameters for geometric figures are given and no
  absolute values (face lists) like in a polygonal mesh. Giving absolute
  values would restrict the flexibility too much. The more computing power is
  available the more detailed a geometric figure can be calculated.
  These things should be implemented in specialisations of GForm.

  Also note that an object's energy exactly outlines its GForm object. So if
  one wants to create an element that radiates a certain distance than there
  have to be at least two elements: one that represents the energy body (which
  is then the bigger one) and another element that represents it's visible
  form.

  The solidness of a form is given by the objects energy level.

  The GForm class itself is just a placeholder for actual form types, which
  are derived from GForm and implement all abstract methods. Since also the
  way forms are represented is different from application to application
  there is no restriction laid upon it by the GForm base class and it is
  totally left to the form developer to decide how forms should be represented
  by providing a proper subclass.
*/

class GForm : public QMutex
{
  public:  //public to make access easier and faster, GForm is basically just a data container anyway

    /**
     * The position of the form.
     */
    GVector3 Position;
    
    /**
     * The rotation of the form.
     */
    GVector3 Rotation;
    
    /**
     * The general ellipsoid form of the element.
     */
    GVector3 Ellipsoid;
    
    /**
     * Initializes form with given attributes.
     */
    GForm(const GVector3& position = GVector3(0,0,0),
          const GVector3& rotation = GVector3(0,0,0),
          const GVector3& ellipsoid = GVector3(1,1,1));
    
    /**
     * Copy constructor.
     */
    GForm(const GForm& original);
  
    /**
     * Virtual destructor makes sure that objects of subclasses
     * get deleted properly.
     */
    virtual ~GForm();
  
    /**
     * Every point of the form is guranteed
     * to be inside a sphere with returned radius and
     * a center at GForm::Position.
     * @return the maximum radius this form has.
     */
    virtual double getRadiusMax() const;
    
    /**
     * 
     * It is guranteed that the form would
     * totally enclose a sphere with returned radius
     * and a center at GForm::Position
     * @return the minimum radius this form has.
     */
    virtual double getRadiusMin() const;
};

}

#endif


syntax highlighted by Code2HTML, v. 0.9.1