Minsky
minsky::Rotate Class Reference

rotate (x,y) by rot (in degrees) around the origin (x0, y0) can be used for rotating multiple points once constructed More...

#include <geometry.h>

Inheritance diagram for minsky::Rotate:
Inheritance graph
Collaboration diagram for minsky::Rotate:
Collaboration graph

Public Member Functions

 Rotate (float rot, float x0, float y0)
 
bool initialisedFrom (float rot, float x, float y) const
 
Point operator() (float x1, float y1) const
 rotate (x1,y1) More...
 
Point operator() (const Point &p) const
 
float x (float x, float y) const
 
float y (float x, float y) const
 

Private Attributes

float angle
 
float ca
 
float sa
 
float x0
 
float y0
 

Static Private Attributes

static constexpr float rad =M_PI/180.0
 

Detailed Description

rotate (x,y) by rot (in degrees) around the origin (x0, y0) can be used for rotating multiple points once constructed

Definition at line 44 of file geometry.h.

Constructor & Destructor Documentation

◆ Rotate()

minsky::Rotate::Rotate ( float  rot,
float  x0,
float  y0 
)
inline

Definition at line 51 of file geometry.h.

Referenced by minsky::Item::MemoisedRotator::update().

51  :
52  angle(rot*rad), ca(std::cos(angle)), sa(std::sin(angle)), x0(x0), y0(y0) {}
Expr sin(const Expr &x)
Definition: expr.h:131
Expr cos(const Expr &x)
Definition: expr.h:137
static constexpr float rad
Definition: geometry.h:49
float angle
Definition: geometry.h:46
Here is the caller graph for this function:

Member Function Documentation

◆ initialisedFrom()

bool minsky::Rotate::initialisedFrom ( float  rot,
float  x,
float  y 
) const
inline

Definition at line 53 of file geometry.h.

References angle, rad, x(), x0, y(), and y0.

Referenced by minsky::Item::MemoisedRotator::update().

54  {return x==x0 && y==y0 && angle==rot*rad;}
static constexpr float rad
Definition: geometry.h:49
float y(float x, float y) const
Definition: geometry.h:60
float angle
Definition: geometry.h:46
float x(float x, float y) const
Definition: geometry.h:59
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator()() [1/2]

Point minsky::Rotate::operator() ( float  x1,
float  y1 
) const
inline

rotate (x1,y1)

Definition at line 56 of file geometry.h.

References x(), and y().

56  {
57  return Point(x(x1,y1),y(x1,y1));}
float y(float x, float y) const
Definition: geometry.h:60
boost::geometry::model::d2::point_xy< float > Point
Definition: geometry.h:34
float x(float x, float y) const
Definition: geometry.h:59
Here is the call graph for this function:

◆ operator()() [2/2]

Point minsky::Rotate::operator() ( const Point p) const
inline

Definition at line 58 of file geometry.h.

References operator()().

Referenced by operator()().

58 {return operator()(p.x(), p.y());}
Point operator()(float x1, float y1) const
rotate (x1,y1)
Definition: geometry.h:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x()

float minsky::Rotate::x ( float  x,
float  y 
) const
inline

Definition at line 59 of file geometry.h.

References ca, sa, x0, y(), and y0.

Referenced by minsky::VariableBase::clickType(), minsky::VariableBase::draw(), minsky::Item::draw(), minsky::Group::draw1edge(), minsky::OperationBase::drawUserFunction(), initialisedFrom(), minsky::Item::onItem(), operator()(), minsky::Item::MemoisedRotator::update(), and y().

59 {return ca*(x-x0)-sa*(y-y0)+x0;}
float y(float x, float y) const
Definition: geometry.h:60
float x(float x, float y) const
Definition: geometry.h:59
Here is the call graph for this function:
Here is the caller graph for this function:

◆ y()

float minsky::Rotate::y ( float  x,
float  y 
) const
inline

Definition at line 60 of file geometry.h.

References ca, sa, x(), x0, and y0.

Referenced by minsky::VariableBase::clickType(), minsky::VariableBase::draw(), minsky::Item::draw(), minsky::Group::draw1edge(), minsky::OperationBase::drawUserFunction(), initialisedFrom(), minsky::Item::onItem(), operator()(), minsky::Item::MemoisedRotator::update(), and x().

60 {return sa*(x-x0)+ca*(y-y0)+y0;}
float y(float x, float y) const
Definition: geometry.h:60
float x(float x, float y) const
Definition: geometry.h:59
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ angle

float minsky::Rotate::angle
private

Definition at line 46 of file geometry.h.

Referenced by initialisedFrom().

◆ ca

float minsky::Rotate::ca
private

Definition at line 47 of file geometry.h.

Referenced by x(), and y().

◆ rad

constexpr float minsky::Rotate::rad =M_PI/180.0
staticprivate

Definition at line 49 of file geometry.h.

Referenced by initialisedFrom().

◆ sa

float minsky::Rotate::sa
private

Definition at line 47 of file geometry.h.

Referenced by x(), and y().

◆ x0

float minsky::Rotate::x0
private

Definition at line 48 of file geometry.h.

Referenced by initialisedFrom(), x(), and y().

◆ y0

float minsky::Rotate::y0
private

Definition at line 48 of file geometry.h.

Referenced by initialisedFrom(), x(), and y().


The documentation for this class was generated from the following file: