-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathPlanePrimitiveShapeConstructor.cpp
43 lines (37 loc) · 1.04 KB
/
PlanePrimitiveShapeConstructor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "PlanePrimitiveShapeConstructor.h"
#include "PlanePrimitiveShape.h"
#include "ScoreComputer.h"
#include <GfxTL/NullClass.h>
size_t PlanePrimitiveShapeConstructor::Identifier() const
{
return 0;
}
unsigned int PlanePrimitiveShapeConstructor::RequiredSamples() const
{
return 3;
}
PrimitiveShape *PlanePrimitiveShapeConstructor::Construct(
const MiscLib::Vector< Vec3f > &points, const MiscLib::Vector< Vec3f > &) const
{
return new PlanePrimitiveShape(points[0], points[1], points[2]);
}
PrimitiveShape *PlanePrimitiveShapeConstructor::Construct(
const MiscLib::Vector< Vec3f > &samples) const
{
Plane plane;
if(!plane.Init(samples))
return NULL;
return new PlanePrimitiveShape(plane);
}
PrimitiveShape *PlanePrimitiveShapeConstructor::Deserialize(std::istream *i,
bool binary) const
{
Plane plane;
plane.Init(binary, i);
PlanePrimitiveShape *shape = new PlanePrimitiveShape(plane);
return shape;
}
size_t PlanePrimitiveShapeConstructor::SerializedSize() const
{
return Plane::SerializedSize();
}