Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / rive-cpp / src / shapes / cubic_mirrored_vertex.cpp
1 #include "rive/shapes/cubic_mirrored_vertex.hpp"
2 #include "rive/math/vec2d.hpp"
3 #include <cmath>
4
5 using namespace rive;
6
7 static Vec2D get_point(const CubicMirroredVertex& v) { return Vec2D(v.x(), v.y()); }
8
9 static Vec2D get_vector(const CubicMirroredVertex& v) {
10     return Vec2D(cos(v.rotation()) * v.distance(), sin(v.rotation()) * v.distance());
11 }
12
13 void CubicMirroredVertex::computeIn() { m_InPoint = get_point(*this) - get_vector(*this); }
14
15 void CubicMirroredVertex::computeOut() { m_OutPoint = get_point(*this) + get_vector(*this); }
16
17 void CubicMirroredVertex::rotationChanged() {
18     m_InValid = m_OutValid = false;
19     markGeometryDirty();
20 }
21 void CubicMirroredVertex::distanceChanged() {
22     m_InValid = m_OutValid = false;
23     markGeometryDirty();
24 }