/*-
 * Copyright (c) 1999,2000 Qube Software, Ltd.
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of the source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 
 * 2. Any redistribution solely in binary form must conspicuously
 *    reproduce the following disclaimer in documentation provided with the
 *    binary redistribution.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'', WITHOUT ANY WARRANTIES, EXPRESS
 * OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  LICENSOR SHALL
 * NOT BE LIABLE FOR ANY LOSS OR DAMAGES RESULTING FROM THE USE OF THIS
 * SOFTWARE, EITHER ALONE OR IN COMBINATION WITH ANY OTHER SOFTWARE.
 * 
 * 	$Id: cylinder3.h,v 1.2 2000/04/20 16:21:57 n_hibma Exp $
 */

#ifndef __cylinder3_h__
#define __cylinder3_h__

MATHS_BEGIN

struct Rayf;

struct EXPORT_QMATHS Cylinder3f
{
    Vec3f	position;
    Vec3f	direction;
    float       radius;
    float       height;

    // Constructors
    Cylinder3f()
    {
    }

    Cylinder3f(const Box3f);
    Cylinder3f(const Vec3f& p, const Vec3f& d, float r, float h)
	: position(p), direction(d), radius(r), height(h)
    {
    }
    
    // Modifiers
    void                add(const Cylinder3f&);
    void                add(const Vec3f&);

    // Testing
    bool                equal(const Cylinder3f& box, float e) const;
    bool		contains(const Vec3f&) const;
    bool		contains(const Cylinder3f&) const;
    bool		contains(const Sphere3f&) const;
    bool		contains(const Box3f&) const;
    bool		intersects(const Sphere3f&) const;
    bool		intersects(const Cylinder3f&) const;
    bool		intersects(const Rayf&, float&, float&) const;

    // Features
    // Matrix operations
    Cylinder3f		transform(const Matrix4f& m) const;
    Cylinder3f		inverseTransform(const Matrix4f& m) const;
};

MATHS_END

#endif

