CPP02
1.0
読み取り中…
検索中…
一致する文字列を見つけられません
main.cpp
[詳解]
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* main.cpp :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2025/04/28 17:16:58 by kamitsui #+# #+# */
9
/* Updated: 2025/05/06 18:02:21 by kamitsui ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
23
#include "
Fixed.hpp
"
24
#include "
Point.hpp
"
25
#include <
iostream
>
26
28
int
main
(
void
) {
29
Point
a(0.0f, 0.0f);
30
Point
b(10.0f, 0.0f);
31
Point
c(5.0f, 5.0f);
32
33
Point
p1(5.0f, 2.5f);
34
Point
p2(0.0f, 0.0f);
35
Point
p3(10.0f, 0.0f);
36
Point
p4(5.0f, 5.0f);
37
Point
p5(6.0f, 6.0f);
38
Point
p6(5.0f, 0.0f);
39
Point
p7(2.0f, 1.0f);
40
Point
p8(1.0f, 0.9f);
41
42
std::cout
<<
"Point a("
<< a.
getX
() <<
", "
<< a.
getY
() <<
"), "
;
43
std::cout
<<
"b("
<< b.
getX
() <<
", "
<< b.
getY
() <<
"), "
;
44
std::cout
<<
"c("
<< c.
getX
() <<
", "
<< c.
getY
() <<
"), "
<<
std::endl
;
45
46
std::cout
<<
"Point p1("
<< p1.
getX
() <<
", "
<< p1.
getY
() <<
") "
47
<<
"is inside triangle (a, b, c): "
<<
bsp
(a, b, c, p1) <<
std::endl
;
48
std::cout
<<
"Point p2("
<< p2.
getX
() <<
", "
<< p2.
getY
() <<
") "
49
<<
"is inside triangle (a, b, c): "
<<
bsp
(a, b, c, p2) <<
std::endl
;
50
std::cout
<<
"Point p3("
<< p3.
getX
() <<
", "
<< p3.
getY
() <<
") "
51
<<
"is inside triangle (a, b, c): "
<<
bsp
(a, b, c, p3) <<
std::endl
;
52
std::cout
<<
"Point p4("
<< p4.
getX
() <<
", "
<< p4.
getY
() <<
") "
53
<<
"is inside triangle (a, b, c): "
<<
bsp
(a, b, c, p4) <<
std::endl
;
54
std::cout
<<
"Point p5("
<< p5.
getX
() <<
", "
<< p5.
getY
() <<
") "
55
<<
"is inside triangle (a, b, c): "
<<
bsp
(a, b, c, p5) <<
std::endl
;
56
std::cout
<<
"Point p6("
<< p6.
getX
() <<
", "
<< p6.
getY
() <<
") "
57
<<
"is inside triangle (a, b, c): "
<<
bsp
(a, b, c, p6) <<
std::endl
;
58
std::cout
<<
"Point p7("
<< p7.
getX
() <<
", "
<< p7.
getY
() <<
") "
59
<<
"is inside triangle (a, b, c): "
<<
bsp
(a, b, c, p7) <<
std::endl
;
60
std::cout
<<
"Point p8("
<< p8.
getX
() <<
", "
<< p8.
getY
() <<
") "
61
<<
"is inside triangle (a, b, c): "
<<
bsp
(a, b, c, p8) <<
std::endl
;
62
63
return
0;
64
}
Point.hpp
Header file for the Point class representing a 2D point with Fixed coordinates.
bsp
bool bsp(Point const a, Point const b, Point const c, Point const point)
Determines if a point is strictly inside a triangle defined by three other points.
Definition
bsp.cpp:51
Point
Definition
Point.hpp:28
Point::getY
Fixed getY() const
Gets the y-coordinate of the point.
Definition
Point.cpp:81
Point::getX
Fixed getX() const
Gets the x-coordinate of the point.
Definition
Point.cpp:74
std::cout
std::endl
T endl(T... args)
main
int main(void)
Definition
main.cpp:25
Fixed.hpp
Header file for the Fixed class representing fixed-point numbers with overloaded operators and min/ma...
iostream
ex03
main.cpp
構築:
1.9.8