Kale
Loading...
Searching...
No Matches
Line.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
20
21namespace Kale {
22
26 struct Line : public Geometry {
27
32
37
41 Line();
42
48 Line(const Vector2f& point1, const Vector2f& point2);
49
54 Vector2f getNormal() const;
55
61 bool isPerpendicular(Ray ray) const;
62
68 bool isPerpendicular(Line line) const;
69
75 bool isParallel(Ray ray) const;
76
82 bool isParallel(Line line) const;
83
88 Rect getBoundingBox() const override;
89
95 bool pointCollision(Vector2f point) const override;
96
102 bool rectCollision(RotatedRect rect) const override;
103
109 bool rectCollision(Rect rect) const override;
110
116 bool circleCollision(Circle circle) const override;
117
123 bool rayCollision(Ray ray) const override;
124
130 bool lineCollision(Line line) const override;
131
132 };
133}
bool rectCollision(RotatedRect rect) const override
Definition Line.cpp:117
bool lineCollision(Line line) const override
Definition Line.cpp:157
bool pointCollision(Vector2f point) const override
Definition Line.cpp:106
Rect getBoundingBox() const override
Definition Line.cpp:94
bool isParallel(Ray ray) const
Definition Line.cpp:77
bool circleCollision(Circle circle) const override
Definition Line.cpp:139
Vector2f point2
Definition Line.hpp:36
Vector2f point1
Definition Line.hpp:31
bool rayCollision(Ray ray) const override
Definition Line.cpp:148
bool isPerpendicular(Ray ray) const
Definition Line.cpp:59
Vector2f getNormal() const
Definition Line.cpp:49