SpherePrimitiveShapeConstructor.cpp
Go to the documentation of this file.
2 
3 #include "ScoreComputer.h"
4 #include "SpherePrimitiveShape.h"
5 #include <GfxTL/NullClass.h>
6 
8  m_maxSphereRadius(maxSphereRadius)
9 {
10 }
11 
12 size_t
14 {
15  return 1;
16 }
17 
18 unsigned int
20 {
21  // we use only 2pts with normals
22  return 2; //4;
23 }
24 
27  const MiscLib::Vector<Vec3f>& normals) const
28 {
29  Sphere sphere;
30  if (!sphere.Init2(points[0], points[1], normals[0], normals[1])) //points[2], points[3]))
31  {
32  return NULL;
33  }
34  if (sphere.Radius() > m_maxSphereRadius)
35  {
36  return NULL;
37  }
38  return new SpherePrimitiveShape(sphere);
39 }
40 
43 {
44  Sphere sphere;
45  if (!sphere.Init(samples))
46  {
47  return NULL;
48  }
49  return new SpherePrimitiveShape(sphere);
50 }
51 
53 SpherePrimitiveShapeConstructor::Deserialize(std::istream* i, bool binary) const
54 {
56  shape->Deserialize(i, binary);
57  return shape;
58 }
59 
60 size_t
62 {
64 }
SpherePrimitiveShapeConstructor::RequiredSamples
unsigned int RequiredSamples() const
Definition: SpherePrimitiveShapeConstructor.cpp:19
SpherePrimitiveShape.h
Sphere::SerializedSize
static size_t SerializedSize()
Definition: Sphere.cpp:440
PrimitiveShape
PrimtiveShape is a shape primitive in conjunction with a parametrization.
Definition: PrimitiveShape.h:34
Sphere::Init2
bool Init2(const Vec3f &p1, const Vec3f &p2, const Vec3f &n1, const Vec3f &n2)
Definition: Sphere.cpp:243
MiscLib::Vector
Definition: Vector.h:19
SpherePrimitiveShapeConstructor::Deserialize
PrimitiveShape * Deserialize(std::istream *i, bool binary=true) const
Definition: SpherePrimitiveShapeConstructor.cpp:53
SpherePrimitiveShapeConstructor::Construct
PrimitiveShape * Construct(const MiscLib::Vector< Vec3f > &points, const MiscLib::Vector< Vec3f > &normals) const
Definition: SpherePrimitiveShapeConstructor.cpp:26
SpherePrimitiveShape
class DLL_LINKAGE SpherePrimitiveShape
Definition: PrimitiveShapeVisitor.h:9
SpherePrimitiveShapeConstructor::SpherePrimitiveShapeConstructor
SpherePrimitiveShapeConstructor(float maxSphereRadius=std::numeric_limits< float >::infinity())
Definition: SpherePrimitiveShapeConstructor.cpp:7
LowStretchSphereParametrization::SerializedSize
static size_t SerializedSize()
Definition: LowStretchSphereParametrization.cpp:112
SpherePrimitiveShapeConstructor::Identifier
size_t Identifier() const
Definition: SpherePrimitiveShapeConstructor.cpp:13
SpherePrimitiveShapeConstructor.h
Sphere::Init
bool Init(const MiscLib::Vector< Vec3f > &samples)
Definition: Sphere.cpp:172
NullClass.h
ScoreComputer.h
Sphere
Definition: Sphere.h:27
SpherePrimitiveShape
Definition: SpherePrimitiveShape.h:20
SpherePrimitiveShape::Deserialize
void Deserialize(std::istream *i, bool binary)
Definition: SpherePrimitiveShape.cpp:301
Sphere::Radius
float Radius() const
Definition: Sphere.cpp:357
SpherePrimitiveShapeConstructor::SerializedSize
size_t SerializedSize() const
Definition: SpherePrimitiveShapeConstructor.cpp:61