ConePrimitiveShapeConstructor.cpp
Go to the documentation of this file.
2
3#include "Cone.h"
5#include "ScoreComputer.h"
6#include <GfxTL/NullClass.h>
7
8size_t
10{
11 return 3;
12}
13
14unsigned int
19
22 const MiscLib::Vector<Vec3f>& normals) const
23{
24 Cone cone;
25 if (!cone.Init(points[0], points[1], points[2], normals[0], normals[1], normals[2]))
26 {
27 return NULL;
28 }
29 if (cone.Angle() > 1.4835298641951801403851371532153)
30 // do not allow cones with an opening angle of more than 85 degrees
31 {
32 return NULL;
33 }
34 return new ConePrimitiveShape(cone);
35}
36
39{
40 Cone cone;
41 if (!cone.Init(samples))
42 {
43 return NULL;
44 }
45 return new ConePrimitiveShape(cone);
46}
47
49ConePrimitiveShapeConstructor::Deserialize(std::istream* i, bool binary) const
50{
51 Cone cone;
52 cone.Init(binary, i);
53 ConePrimitiveShape* shape = new ConePrimitiveShape(cone);
54 return shape;
55}
56
57size_t
class DLL_LINKAGE ConePrimitiveShape
PrimitiveShape * Deserialize(std::istream *i, bool binary=true) const
PrimitiveShape * Construct(const MiscLib::Vector< Vec3f > &points, const MiscLib::Vector< Vec3f > &normals) const
Definition Cone.h:25
static size_t SerializedSize()
Definition Cone.cpp:745
bool Init(const MiscLib::Vector< Vec3f > &samples)
Definition Cone.cpp:47
float Angle() const
Definition Cone.h:389
PrimtiveShape is a shape primitive in conjunction with a parametrization.