ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Circle.cpp
Go to the documentation of this file.
1#include "Circle.h"
2
3Circle::Circle(Vector2D center, float radius) : Shape(center, Vector2D(radius, radius), 0.0f), radius(radius) {}
4
6 float x = (point.X - center.X);
7 float y = (point.Y - center.Y);
8 float powRad = radius * radius;
9
10 return x * x + y * y < powRad;
11}
Defines the Circle class for representing circular shapes in 2D space.
Circle(Vector2D center, float radius)
Constructs a Circle object with a specified center and radius.
Definition Circle.cpp:3
float radius
Radius of the circle.
Definition Circle.h:23
bool IsInShape(Vector2D point) override
Checks if a given point lies within the circle's boundaries.
Definition Circle.cpp:5
Abstract base class for 2D geometric shapes.
Definition Shape.h:22
Vector2D center
The center point of the shape.
Definition Shape.h:24
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Definition Vector2D.h:27
float X
The X-component of the 2D vector.
Definition Vector2D.h:29
float Y
The Y-component of the 2D vector.
Definition Vector2D.h:30