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