SimpleTorusParametrization.cpp
Go to the documentation of this file.
2
4{
5 m_hcs.FromNormal(m_torus->AxisDirection());
6}
7
8void
10{
11 m_torus = &torus;
12 m_hcs.FromNormal(m_torus->AxisDirection());
13}
14
15void
17 float epsilon,
18 bool* uwrap,
19 bool* vwrap) const
20{
21 if (bbox.Max()[0] - bbox.Min()[0] >=
22 2 * M_PI *
23 ((m_torus->MajorRadius() < m_torus->MinorRadius() * 2)
24 ? m_torus->MajorRadius() + m_torus->MinorRadius()
25 : m_torus->MajorRadius()) -
26 2 * epsilon)
27 {
28 *uwrap = true; // wrap around major component
29 }
30 else
31 {
32 *uwrap = false;
33 }
34 if (bbox.Max()[1] - bbox.Min()[1] >= 2 * M_PI * m_torus->MinorRadius() - 2 * epsilon)
35 {
36 *vwrap = true; // wrap around minor component
37 }
38 else
39 {
40 *vwrap = false;
41 }
42}
43
44size_t
49
50void
51SimpleTorusParametrization::Serialize(std::ostream* o, bool binary) const
52{
53 // for now only output placeholder for rotation of hcs
54 float rot = 0;
55 if (binary)
56 {
57 o->write((char*)&rot, sizeof(rot));
58 }
59 else
60 {
61 *o << rot << " ";
62 }
63}
64
65void
66SimpleTorusParametrization::Deserialize(std::istream* i, bool binary)
67{
68 // read the placeholder
69 float rot;
70 if (binary)
71 {
72 i->read((char*)&rot, sizeof(rot));
73 }
74 else
75 {
76 *i >> rot;
77 }
78}
#define float
Definition 16_Level.h:22
#define M_PI
Definition MathTools.h:17
Point & Min()
Definition AABox.hpp:68
Point & Max()
Definition AABox.hpp:82
void Deserialize(std::istream *i, bool binary)
void Serialize(std::ostream *o, bool binary) const
void WrapBitmap(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, bool *uwrap, bool *vwrap) const
Definition Torus.h:21