TorusPrimitiveShapeConstructor.cpp
Go to the documentation of this file.
2 #include "TorusPrimitiveShape.h"
3 #include "ScoreComputer.h"
4 #include <GfxTL/NullClass.h>
5 
7 {
8  return 4;
9 }
10 
12 {
13  return 4;
14 }
15 
17  const MiscLib::Vector< Vec3f >& points,
18  const MiscLib::Vector< Vec3f >& normals) const
19 {
21  for (size_t i = 0; i < points.size(); ++i)
22  {
23  samples.push_back(points[i]);
24  }
25  for (size_t i = 0; i < normals.size(); ++i)
26  {
27  samples.push_back(normals[i]);
28  }
29  return Construct(samples);
30 }
31 
33  const MiscLib::Vector< Vec3f >& samples) const
34 {
35  Torus torus;
36  if (!torus.Init(samples))
37  {
38  return NULL;
39  }
40  return new TorusPrimitiveShape(torus);
41 }
42 
44  bool binary) const
45 {
47  shape->Deserialize(i, binary);
48  return shape;
49 }
50 
52 {
53  return Torus::SerializedSize() +
55 }
TorusPrimitiveShapeConstructor::SerializedSize
size_t SerializedSize() const
Definition: TorusPrimitiveShapeConstructor.cpp:51
MiscLib::Vector::push_back
void push_back(const T &v)
Definition: Vector.h:346
TorusPrimitiveShape.h
Torus
Definition: Torus.h:18
TorusPrimitiveShape
Definition: TorusPrimitiveShape.h:12
PrimitiveShape
PrimtiveShape is a shape primitive in conjunction with a parametrization.
Definition: PrimitiveShape.h:32
MiscLib::Vector
Definition: Vector.h:19
MiscLib::Vector::size
size_type size() const
Definition: Vector.h:212
TorusPrimitiveShapeConstructor::RequiredSamples
unsigned int RequiredSamples() const
Definition: TorusPrimitiveShapeConstructor.cpp:11
TorusPrimitiveShape::Deserialize
void Deserialize(std::istream *i, bool binary)
Definition: TorusPrimitiveShape.cpp:141
TorusPrimitiveShapeConstructor::Construct
PrimitiveShape * Construct(const MiscLib::Vector< Vec3f > &points, const MiscLib::Vector< Vec3f > &normals) const
Definition: TorusPrimitiveShapeConstructor.cpp:16
LowStretchTorusParametrization::SerializedSize
static size_t SerializedSize()
Definition: LowStretchTorusParametrization.cpp:140
Torus::Init
bool Init(const MiscLib::Vector< Vec3f > &samples)
Definition: Torus.cpp:64
NullClass.h
TorusPrimitiveShape
class DLL_LINKAGE TorusPrimitiveShape
Definition: PrimitiveShapeVisitor.h:12
Torus::SerializedSize
static size_t SerializedSize()
Definition: Torus.cpp:592
ScoreComputer.h
TorusPrimitiveShapeConstructor::Identifier
size_t Identifier() const
Definition: TorusPrimitiveShapeConstructor.cpp:6
TorusPrimitiveShapeConstructor::Deserialize
PrimitiveShape * Deserialize(std::istream *i, bool binary=true) const
Definition: TorusPrimitiveShapeConstructor.cpp:43
TorusPrimitiveShapeConstructor.h