145 std::vector<Object3D*> objects;
161 KDTreeNode(std::vector<Object3D*> objects,
unsigned int maxObjectNumber,
unsigned int maxDepth,
KDTreeNode* parent =
nullptr,
unsigned int depth = 0);
Defines functions that are used to ask for values to the user, and to interactively create 3D objects...
nlohmann::json json
Definition: InterfaceGestion.h:14
DoubleVec3D getMaxPoint(std::vector< Object3D * > objects)
Computes the maximum point of a cuboid containing all the objects.
Definition: KDTreeNode.cpp:318
DoubleVec3D getMinPoint(std::vector< Object3D * > objects)
Computes the minimum point of a cuboid containing all the objects.
Definition: KDTreeNode.cpp:300
void to_json(json &j, const KDTreeNode &node)
Conversion to json.
Definition: KDTreeNode.cpp:338
A three-dimensional vector using double values.
Definition: DoubleVec3D.h:190
A node of a k-d tree.
Definition: KDTreeNode.h:140
unsigned int getMaxObjectNumberLeaf() const
Gives the maximum number of objects in a leaf of this tree.
Definition: KDTreeNode.cpp:129
bool isIn(DoubleVec3D point) const
Returns whether a point is inside this node's cuboid-shaped volume.
Definition: KDTreeNode.cpp:196
std::vector< Object3D * > getObjects() const
Getter for this node's objects.
Definition: KDTreeNode.cpp:117
KDTreeNode()
Default constructor. Everything is set to 0 by default.
Definition: KDTreeNode.cpp:10
Intersection getIntersectionForward(const Ray &ray) const
Computes the intersection going from the top to the bottom of the tree.
Definition: KDTreeNode.cpp:205
unsigned int getDepth() const
Getter for this node's depth.
Definition: KDTreeNode.cpp:114
double intersectionDistance(const Ray &ray) const
Gives the distance to the closest intersection between this node's surface and a ray.
Definition: KDTreeNode.cpp:135
KDTreeNode * getParent() const
Getter for this node's parent.
Definition: KDTreeNode.cpp:118
~KDTreeNode()
Destructor.
Definition: KDTreeNode.cpp:107
KDTreeNode * getChildGreater() const
Getter for this node's greater child.
Definition: KDTreeNode.cpp:120
unsigned int getMaxDepth() const
Gives the maximum depth of this tree.
Definition: KDTreeNode.cpp:123
DoubleVec3D getMaxCoord() const
Getter for this node's maximum coordinate.
Definition: KDTreeNode.cpp:116
Intersection getIntersectionBackwards(const Ray &ray, const KDTreeNode *ignore=nullptr) const
Computes the intersection going from the bottom to the top of the tree.
Definition: KDTreeNode.cpp:265
DoubleVec3D getMinCoord() const
Getter for this node's minimum coordinate.
Definition: KDTreeNode.cpp:115
KDTreeNode * getChildSmaller() const
Getter for this node's smaller child.
Definition: KDTreeNode.cpp:119
Abstract class for a three-dimentional object.
Definition: Object3D.h:121
Combination of an origin and a direction.
Definition: Ray.h:44
A struct binding a pointer to an Object3D, a distance, and a pointer to a KDTreeNode.
Definition: KDTreeNode.h:152
Object3D * object
The Object3D with which the ray intersects.
Definition: KDTreeNode.h:153
const KDTreeNode * kdTreeNode
The KDTreeNode in which the ray and the object intersect.
Definition: KDTreeNode.h:155
double distance
The distance between the ray origin and the intersection point.
Definition: KDTreeNode.h:154
Intersection(Object3D *object=nullptr, double distance=INFINITY, const KDTreeNode *kdTreeNode=nullptr)
Main constructor.
Definition: KDTreeNode.cpp:5