Library of Assembled Shared Sources
disk_3d.h
Go to the documentation of this file.
1/** @file
2 * @author Bram de Greve (bram@cocamware.com)
3 * @author Tom De Muer (tom@cocamware.com)
4 *
5 * *** BEGIN LICENSE INFORMATION ***
6 *
7 * The contents of this file are subject to the Common Public Attribution License
8 * Version 1.0 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://lass.sourceforge.net/cpal-license. The License is based on the
11 * Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover
12 * use of software over a computer network and provide for limited attribution for
13 * the Original Developer. In addition, Exhibit A has been modified to be consistent
14 * with Exhibit B.
15 *
16 * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
17 * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
18 * language governing rights and limitations under the License.
19 *
20 * The Original Code is LASS - Library of Assembled Shared Sources.
21 *
22 * The Initial Developer of the Original Code is Bram de Greve and Tom De Muer.
23 * The Original Developer is the Initial Developer.
24 *
25 * All portions of the code written by the Initial Developer are:
26 * Copyright (C) 2004-2022 the Initial Developer.
27 * All Rights Reserved.
28 *
29 * Contributor(s):
30 *
31 * Alternatively, the contents of this file may be used under the terms of the
32 * GNU General Public License Version 2 or later (the GPL), in which case the
33 * provisions of GPL are applicable instead of those above. If you wish to allow use
34 * of your version of this file only under the terms of the GPL and not to allow
35 * others to use your version of this file under the CPAL, indicate your decision by
36 * deleting the provisions above and replace them with the notice and other
37 * provisions required by the GPL License. If you do not delete the provisions above,
38 * a recipient may use your version of this file under either the CPAL or the GPL.
39 *
40 * *** END LICENSE INFORMATION ***
41 */
42
43
44
45/** @struct lass::prim::Disk3D
46 * @brief 3D Disk
47 * @author Bram de Greve
48 * @date 2010
49 */
50
51#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_DISK_3D_H
52#define LASS_GUARDIAN_OF_INCLUSION_PRIM_DISK_3D_H
53
54#include "prim_common.h"
55#include "disk_3d.h"
56#include "plane_3d.h"
57
58namespace lass
59{
60
61namespace prim
62{
63
64template<typename T>
65class Disk3D
66{
67public:
68
69 typedef Disk3D<T> TSelf;
70
71 typedef Point3D<T> TPoint;
72 typedef typename TPoint::TVector TVector;
73
74 typedef typename TPoint::TValue TValue;
75 typedef typename TPoint::TParam TParam;
76 typedef typename TPoint::TReference TReference;
77 typedef typename TPoint::TConstReference TConstReference;
78 typedef typename TPoint::TNumTraits TNumTraits;
80 typedef typename TPlane::TUV TUV;
81
82 enum { dimension = TPoint::dimension }; /**< number of dimensions */
83
84 template <typename U> struct Rebind
85 {
86 typedef Disk3D<U> Type;
87 };
88
89 Disk3D();
90 Disk3D(const TPoint& center, const TVector& normal, TParam radius);
91
92 const TPoint& center() const;
93 void setCenter(const TPoint& center);
94
95 const TVector& normal() const;
96 void setNormal(const TVector& normal);
97
98 TConstReference radius() const;
99 TReference radius();
100
101 const TPlane& plane() const;
102 const TValue area() const;
103
104 const TPoint point(TParam u, TParam v) const;
105 const TPoint point(const TUV& uv) const;
106 const TUV uv(const TPoint& point) const;
107
108 bool isValid() const;
109
110private:
111
112 TPlane plane_;
113 TValue radius_;
114};
115
116template<typename T> std::ostream& operator<<(std::ostream& stream, const Disk3D<T>& disk);
117template <typename T> io::XmlOStream& operator<<(io::XmlOStream& stream, const Disk3D<T>& disk);
118
119}
120
121}
122
123#include "disk_3d.inl"
124
125#ifdef LASS_GUARDIAN_OF_INCLUSION_PRIM_AABB_3D_H
126# include "aabb_3d_disk_3d.h"
127#endif
128
129#ifdef LASS_GUARDIAN_OF_INCLUSION_PRIM_SPHERE_3D_H
130# include "disk_3d_sphere_3d.h"
131#endif
132
133#ifdef LASS_GUARDIAN_OF_INCLUSION_PRIM_RAY_3D_H
134#include "disk_3d_ray_3d.h"
135#endif
136
137#endif
138
139// --- END OF FILE ------------------------------------------------------------------------------
Output stream for writing a selection of geometric primitives to XML files.
bool isValid() const
return true if sphere has a non-negative radius
Definition disk_3d.inl:191
const TValue area() const
return area of surface of sphere
Definition disk_3d.inl:133
const TPlane & plane() const
return area of surface of sphere
Definition disk_3d.inl:144
A 3D hyper plane.
Definition plane_3d.h:361
set of geometrical primitives
Definition aabb_2d.h:81
Library for Assembled Shared Sources.
Definition config.h:53