8#ifndef W_FUNCTION_ENTITY_HPP
9#define W_FUNCTION_ENTITY_HPP
13#pragma GCC diagnostic push
14#pragma GCC diagnostic ignored "-Wfloat-equal"
15#pragma GCC diagnostic ignored "-Wswitch-default"
16#include <SFML/System/Vector2.hpp>
17#include <SFML/Graphics.hpp>
18#pragma GCC diagnostic pop
51 FunctionEntity(
const sf::Vector2f origin,
const sf::Vector2f scale, std::function<
double(
double ) > func );
68 [[nodiscard]] sf::Color
getColor( )
const;
100 [[nodiscard]] sf::Vector2f
getOffset( )
const;
158 void setOffset(
float offsetX,
float offsetY );
179 void setScale( sf::Vector2f scale );
208 void alignToYAxis(
float normalizedOffsetX = 0.0f,
float normalizedOffsetY = 0.0f );
217 void drawFunction( sf::RenderWindow &window,
double startX,
double endX,
size_t nbPoints = 1000 );
Represents an entity in the ECS (Entity-Component System) architecture.
Definition wEntity.hpp:60
LineStyle
Available styles for line rendering.
Definition wLineStyleComponent.hpp:35
void alignToYAxis(float normalizedOffsetX=0.0f, float normalizedOffsetY=0.0f)
Rotates the function by 90 degrees and swaps scales accordingly.
Definition wFunctionEntity.cpp:170
void setDashLength(float dashLength)
Set the length of each dash when the line style is Dashed.
Definition wFunctionEntity.cpp:122
float getGapLength() const
Get the gap length between dashes or dots.
Definition wFunctionEntity.cpp:80
void setOffset(float offsetX, float offsetY)
Set an offset applied to the function curve.
Definition wFunctionEntity.cpp:134
void drawFunction(sf::RenderWindow &window, double startX, double endX, size_t nbPoints=1000)
Draw the function on the target window.
Definition wFunctionEntity.cpp:191
sf::Color getColor() const
Get the color of the function curve.
Definition wFunctionEntity.cpp:56
void setThickness(float thickness)
Set the line thickness of the function curve.
Definition wFunctionEntity.cpp:110
wEngine::LineStyleComponent::LineStyle getLineStyle() const
Get the line style of the function curve.
Definition wFunctionEntity.cpp:68
sf::Vector2f getPosition() const
Get the position (origin) of the function in pixel space.
Definition wFunctionEntity.cpp:50
void addExcludedInterval(double min, double max)
Add an excluded interval where the function should not be drawn.
Definition wFunctionEntity.cpp:158
void setPosition(sf::Vector2f position)
Set the position (origin) of the function in pixel space.
Definition wFunctionEntity.cpp:98
void setGapLength(float gapLength)
Set the length of the gap between dashes or dots.
Definition wFunctionEntity.cpp:128
float getRotation() const
Get the current rotation angle of the function curve.
Definition wFunctionEntity.cpp:92
float getThickness() const
Get the line thickness of the function curve.
Definition wFunctionEntity.cpp:62
void setLineStyle(wEngine::LineStyleComponent::LineStyle style)
Set the line style of the function curve.
Definition wFunctionEntity.cpp:116
sf::Vector2f getOffset() const
Get the current offset applied to the function curve.
Definition wFunctionEntity.cpp:86
void setScale(sf::Vector2f scale)
Sets the scaling factors for the function graph.
Definition wFunctionEntity.cpp:146
float getDashLength() const
Get the dash length when the line style is Dashed.
Definition wFunctionEntity.cpp:74
void clearExcludedIntervals()
Clear all excluded intervals.
Definition wFunctionEntity.cpp:164
FunctionEntity(const sf::Vector2f origin, const sf::Vector2f scale, std::function< double(double) > func)
Construct a new FunctionEntity.
Definition wFunctionEntity.cpp:31
virtual ~FunctionEntity()=default
Virtual destructor.
void setRotation(float angleDegrees)
Set the rotation angle of the function curve.
Definition wFunctionEntity.cpp:140
void setColor(sf::Color color)
Set the color of the function curve.
Definition wFunctionEntity.cpp:104
Definition wAxisEntity.cpp:17