From 726686c9b378f3a727ded52226b13a760cba1e6c Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Sat, 3 Sep 2016 17:09:24 -0300 Subject: Inductor under implementation Ind motor, sync condenser and load implemented --- Project/Element.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Project/Element.cpp') diff --git a/Project/Element.cpp b/Project/Element.cpp index d00837a..ff7d246 100644 --- a/Project/Element.cpp +++ b/Project/Element.cpp @@ -20,6 +20,27 @@ void Element::DrawCircle(wxPoint2DDouble position, double radius, int numSegment glEnd(); } +void Element::DrawArc(wxPoint2DDouble position, double radius, double initAngle, double finalAngle, int numSegments, GLenum mode) const +{ + double initAngRad = wxDegToRad(initAngle); + double finalAngRad = wxDegToRad(finalAngle); + glBegin(mode); + for(int i = 0; i <= numSegments; i++) { + double theta = initAngRad + (finalAngRad - initAngRad) * double(i) / double(numSegments); + glVertex2f(radius * std::cos(theta) + position.m_x, radius * std::sin(theta) + position.m_y); + } + glEnd(); +} + +void Element::DrawTriangle(std::vector points, GLenum mode) const +{ + glBegin(mode); + for(int i=0; i<3; i++) { + glVertex2d(points[i].m_x, points[i].m_y); + } + glEnd(); +} + void Element::DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode) const { glBegin(mode); // TODO: GL_QUADS é obsoleto (OpenGL 3.0+), encontrar outra solução. -- cgit