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