SpherePrimitiveShapeConstructor.cpp
Go to the documentation of this file.
2
3#include "ScoreComputer.h"
5#include <GfxTL/NullClass.h>
6
8 m_maxSphereRadius(maxSphereRadius)
9{
10}
11
12size_t
17
18unsigned 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
53SpherePrimitiveShapeConstructor::Deserialize(std::istream* i, bool binary) const
54{
56 shape->Deserialize(i, binary);
57 return shape;
58}
59
60size_t
class DLL_LINKAGE SpherePrimitiveShape
PrimtiveShape is a shape primitive in conjunction with a parametrization.
PrimitiveShape * Deserialize(std::istream *i, bool binary=true) const
PrimitiveShape * Construct(const MiscLib::Vector< Vec3f > &points, const MiscLib::Vector< Vec3f > &normals) const
SpherePrimitiveShapeConstructor(float maxSphereRadius=std::numeric_limits< float >::infinity())
void Deserialize(std::istream *i, bool binary)
static size_t SerializedSize()
Definition Sphere.cpp:440
float Radius() const
Definition Sphere.cpp:357
bool Init2(const Vec3f &p1, const Vec3f &p2, const Vec3f &n1, const Vec3f &n2)
Definition Sphere.cpp:243
bool Init(const MiscLib::Vector< Vec3f > &samples)
Definition Sphere.cpp:172