ZFFramework
 
Loading...
Searching...
No Matches
ZFBezier.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFBezier_h_
7#define _ZFI_ZFBezier_h_
8
9#include "ZFAlgorithmDef.h"
11
16public:
18 ZFBezier(void) {
19 this->controlPoint(0, 0, 1, 1);
20 }
21
23 : p0x(ref.p0x)
24 , p0y(ref.p0y)
25 , p1x(ref.p1x)
26 , p1y(ref.p1y)
27 , ax(ref.ax)
28 , bx(ref.bx)
29 , cx(ref.cx)
30 , ay(ref.ay)
31 , by(ref.by)
32 , cy(ref.cy)
33 {
34 }
35
41 ) {
42 this->controlPoint(p0x, p0y, p1x, p1y);
43 }
44
45 ZFBezier &operator = (ZF_IN const ZFBezier &ref) {
46 this->p0x = ref.p0x;
47 this->p0y = ref.p0y;
48 this->p1x = ref.p1x;
49 this->p1y = ref.p1y;
50 this->ax = ref.ax;
51 this->bx = ref.bx;
52 this->cx = ref.cx;
53 this->ay = ref.ay;
54 this->by = ref.by;
55 this->cy = ref.cy;
56 return *this;
57 }
58 zfbool operator == (ZF_IN const ZFBezier &ref) const {
59 return (this->p0x == ref.p0x
60 && this->p0y == ref.p0y
61 && this->p1x == ref.p1x
62 && this->p1y == ref.p1y
63 );
64 }
65 inline zfbool operator != (ZF_IN const ZFBezier &ref) const {return !this->operator == (ref);}
67
68public:
75 );
76
77public:
84
91
98
105
112
119
120public:
125private:
126 zffloat ax;
127 zffloat bx;
128 zffloat cx;
129
130 zffloat ay;
131 zffloat by;
132 zffloat cy;
133};
134
135// ============================================================
168
169// ============================================================
190
192#define ZFSerializableKeyword_ZFBezier_p0x "p0x"
194#define ZFSerializableKeyword_ZFBezier_p0y "p0y"
196#define ZFSerializableKeyword_ZFBezier_p1x "p1x"
198#define ZFSerializableKeyword_ZFBezier_p1y "p1y"
199
200// ============================================================
202
204#endif // #ifndef _ZFI_ZFBezier_h_
205
global header for ZFAlgorithm module
#define ZFLIB_ZFAlgorithm
used to export symbols
Definition ZFAlgorithmDef.h:14
ZFLIB_ZFAlgorithm zfbool ZFBezierToStringT(zfstring &s, _ZFP_PropTypeW_ZFBezier const &v, zfstring *errorHint=zft_zfnull)
util method to convert ZFBezier to string
ZFBezier const & ZFBezierLinear(void)
linear curve
Definition ZFBezier.h:143
ZFBezier const & ZFBezierZero(void)
linear curve
Definition ZFBezier.h:139
ZFBezier const & ZFBezierEaseInOut(void)
ease in out curve
Definition ZFBezier.h:155
ZFBezier const & ZFBezierBackInOut(void)
back in out curve
Definition ZFBezier.h:167
ZFBezier const & ZFBezierBackOut(void)
back out curve
Definition ZFBezier.h:163
ZFBezier const & ZFBezierEaseIn(void)
ease in curve
Definition ZFBezier.h:147
ZFBezier const & ZFBezierEaseOut(void)
ease out curve
Definition ZFBezier.h:151
ZFBezier const & ZFBezierBackIn(void)
back in curve
Definition ZFBezier.h:159
#define zffinal
dummy macro shows that a method or class is designed must not to be overrided
Definition ZFCoreTypeDef_ClassType.h:63
#define zfclassLikePOD
shows the class is not a POD type, but you may use it like a POD except memset it to 0
Definition ZFCoreTypeDef_ClassType.h:41
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_zft_zffloat zffloat
same as float, see zfindex
Definition ZFCoreTypeDef_CoreType.h:183
#define ZFOUTPUT_TYPE(T_Type, outputAction)
declare your custom type conversion to string, convenient for debug
Definition ZFCoreTypeDef_OtherType.h:221
#define ZFEXPORT_VAR_READONLY_DECLARE(ZFLIB_, Type, Name)
see ZFEXPORT_VAR_DECLARE
Definition ZFExport.h:115
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define ZFTYPEID_DECLARE(ZFLIB_, TypeName, Type)
register a type for reflection
Definition ZFTypeIdDeclare.h:137
#define ZFTYPEID_REG(ZFLIB_, TypeName, Type,...)
see ZFTYPEID_DECLARE
Definition ZFTypeIdDeclare.h:151
curve
Definition ZFBezier.h:15
zffloat t_by_y(zffloat y) const
solve t with given y
zffloat p1y
control point
Definition ZFBezier.h:124
zffloat y_by_x(zffloat x) const
solve y with given x
ZFBezier(const ZFBezier &ref)
construct from another curve
Definition ZFBezier.h:22
zffloat p0x
control point
Definition ZFBezier.h:121
zffloat p1x
control point
Definition ZFBezier.h:123
ZFBezier(zffloat p0x, zffloat p0y, zffloat p1x, zffloat p1y)
construct with control point
Definition ZFBezier.h:36
ZFBezier & controlPoint(zffloat p0x, zffloat p0y, zffloat p1x, zffloat p1y)
change control point
zffloat y_by_t(zffloat t) const
solve y with given t
zffloat x_by_y(zffloat y) const
solve x with given y
ZFBezier(void)
construct a linear curve
Definition ZFBezier.h:18
zffloat p0y
control point
Definition ZFBezier.h:122
zffloat t_by_x(zffloat x) const
solve t with given x
zffloat x_by_t(zffloat t) const
solve x with given t