Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SampleFitCubicToCircle::Click Class Reference
Inheritance diagram for SampleFitCubicToCircle::Click:
ClickHandlerSlide::Click

Public Member Functions

 Click (int ptIdx)
 
void doClick (SampleFitCubicToCircle *that)
 
- Public Member Functions inherited from ClickHandlerSlide::Click
 Click ()
 
 Click (std::function< bool(Click *)> f)
 
virtual ~Click ()=default
 

Additional Inherited Members

- Public Attributes inherited from ClickHandlerSlide::Click
SkPoint fOrig = {0, 0}
 
SkPoint fPrev = {0, 0}
 
SkPoint fCurr = {0, 0}
 
skui::InputState fState = skui::InputState::kDown
 
skui::ModifierKey fModifierKeys = skui::ModifierKey::kNone
 
SkMetaData fMeta
 
std::function< bool(Click *)> fFunc
 
bool fHasFunc = false
 

Detailed Description

Definition at line 197 of file FitCubicToCircleSlide.cpp.

Constructor & Destructor Documentation

◆ Click()

SampleFitCubicToCircle::Click::Click ( int  ptIdx)
inline

Definition at line 199 of file FitCubicToCircleSlide.cpp.

199: fPtIdx(ptIdx) {}

Member Function Documentation

◆ doClick()

void SampleFitCubicToCircle::Click::doClick ( SampleFitCubicToCircle that)
inline

Definition at line 201 of file FitCubicToCircleSlide.cpp.

201 {
202 double dx = fCurr.fX - kCenterX;
203 double dy = fCurr.fY - kCenterY;
204 double l = std::sqrt(dx*dx + dy*dy);
205 that->fEndptsX[fPtIdx] = dx/l;
206 that->fEndptsY[fPtIdx] = dy/l;
207 if (that->fEndptsX[0] * that->fEndptsY[1] - that->fEndptsY[0] * that->fEndptsX[1] < 0) {
208 std::swap(that->fEndptsX[0], that->fEndptsX[1]);
209 std::swap(that->fEndptsY[0], that->fEndptsY[1]);
210 fPtIdx = 1 - fPtIdx;
211 }
212 that->fitCubic();
213 }
static constexpr int kCenterX
static constexpr int kCenterY
void swap(sk_sp< T > &a, sk_sp< T > &b)
Definition: SkRefCnt.h:341
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
Definition: SkVx.h:706
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165

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