cgv
plane.h
1
#pragma once
2
3
#include <cgv/math/vec.h>
4
5
namespace
cgv
{
6
namespace
media {
7
12
template
<
class
T>
13
class
plane
14
{
15
public
:
16
cgv::math::vec<T>
h;
18
plane
(
int
dim = 3)
19
{
20
h.
resize
(dim+1);
21
}
25
plane
(
const
cgv::math::vec<T>
&n,
const
T &distance)
26
{
27
h.
resize
(n.
size
()+1);
28
for
(
unsigned
int
i=0; i<n.
size
(); ++i)
29
h(i) = n(i);
30
h(n.
size
()) = -distance;
31
}
33
cgv::math::vec<T>
get_normal
()
const
34
{
35
cgv::math::vec<T>
n;
36
n.
resize
(h.
size
()-1);
37
for
(
unsigned
int
i=0; i<n.
size
(); ++i)
38
n(i) = h(i);
39
return
n;
40
}
42
T
get_distance
()
const
43
{
44
return
-h(h.
size
()-1);
45
}
46
};
47
48
}
49
}
50
cgv::math::vec::resize
void resize(unsigned dim)
resize the vector
Definition:
vec.h:557
cgv::media::plane::plane
plane(int dim=3)
construct plane of give dimension allocating a homogenous vector of one dimension mor
Definition:
plane.h:18
cgv::math::vec
A column vector class.
Definition:
fvec.h:13
cgv::math::vec::size
unsigned size() const
number of elements
Definition:
vec.h:97
cgv::media::plane
Definition:
plane.h:14
cgv::media::plane::plane
plane(const cgv::math::vec< T > &n, const T &distance)
Definition:
plane.h:25
cgv::media::plane::get_distance
T get_distance() const
return the distance of the plane to the origin
Definition:
plane.h:42
cgv::media::plane::get_normal
cgv::math::vec< T > get_normal() const
return the normal vector
Definition:
plane.h:33
cgv
the cgv namespace
Definition:
vr_calib.cxx:9
projects
git
cgv
cgv
media
plane.h
Generated by
1.8.18