Kale
Loading...
Searching...
No Matches
Ray.hpp
Go to the documentation of this file.
1/*
2 Copyright 2022 Rishi Challa
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#pragma once
18
22
23namespace Kale {
24
28 struct Ray : public Geometry {
29
34
39
43 Ray();
44
50 Ray(const Vector2f& origin, const Vector2f& direction);
51
58 Ray(const Vector2f& origin, float angle, AngleUnit unit);
59
64 Ray(const Line& line);
65
71 float getAngle(AngleUnit unit) const;
72
78 bool isPerpendicular(Ray ray) const;
79
85 bool isPerpendicular(Line line) const;
86
92 bool isParallel(Ray ray) const;
93
99 bool isParallel(Line line) const;
100
105 Rect getBoundingBox() const override;
106
112 bool pointCollision(Vector2f point) const override;
113
119 bool rectCollision(RotatedRect rect) const override;
120
126 bool rectCollision(Rect rect) const override;
127
133 bool circleCollision(Circle circle) const override;
134
140 bool rayCollision(Ray ray) const override;
141
147 bool lineCollision(Line line) const override;
148
149 };
150}
AngleUnit
Definition Utils.hpp:30
bool pointCollision(Vector2f point) const override
Definition Ray.cpp:128
Rect getBoundingBox() const override
Definition Ray.cpp:115
Vector2f direction
Definition Ray.hpp:38
Ray()
Definition Ray.cpp:32
bool isPerpendicular(Ray ray) const
Definition Ray.cpp:80
bool isParallel(Ray ray) const
Definition Ray.cpp:98
float getAngle(AngleUnit unit) const
Definition Ray.cpp:69
Vector2f origin
Definition Ray.hpp:33
bool lineCollision(Line line) const override
Definition Ray.cpp:193
bool rayCollision(Ray ray) const override
Definition Ray.cpp:167
bool rectCollision(RotatedRect rect) const override
Definition Ray.cpp:138
bool circleCollision(Circle circle) const override
Definition Ray.cpp:158