2015-06-17 13:16:06 +08:00
|
|
|
|
/****************************************************************************
|
2014-01-07 11:47:11 +08:00
|
|
|
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
THE SOFTWARE.
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef __CCUTILMATH_H__
|
|
|
|
|
#define __CCUTILMATH_H__
|
|
|
|
|
|
2014-04-27 01:11:22 +08:00
|
|
|
|
#include "2d/CCSprite.h"
|
2016-03-20 21:53:44 +08:00
|
|
|
|
#include "editor-support/cocostudio/CCArmatureDefine.h"
|
|
|
|
|
#include "editor-support/cocostudio/CocosStudioExport.h"
|
2013-06-06 12:02:54 +08:00
|
|
|
|
#include <math.h>
|
|
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
|
namespace cocostudio {
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
|
|
#define CC_DOUBLE_PI (M_PI*2)
|
|
|
|
|
|
|
|
|
|
#define CC_HALF_PI (M_PI * 0.5f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! hit test function
|
2014-07-21 17:45:56 +08:00
|
|
|
|
bool CC_STUDIO_DLL isSpriteContainPoint(cocos2d::Sprite *sprite, cocos2d::Vec2 point);
|
|
|
|
|
bool CC_STUDIO_DLL isSpriteContainPoint(cocos2d::Sprite *sprite, cocos2d::Vec2 point, cocos2d::Vec2 &outPoint);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
|
|
#define CC_SPRITE_CONTAIN_POINT(sprite, point) isSpriteContainPoint((sprite), (point))
|
|
|
|
|
#define CC_SPRITE_CONTAIN_POINT_WITH_RETURN(sprite, point, outPoint) isSpriteContainPoint((sprite), (point), outPoint)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! motion curve function
|
2014-07-21 17:45:56 +08:00
|
|
|
|
cocos2d::Vec2 CC_STUDIO_DLL bezierTo(float t, cocos2d::Vec2 &point1, cocos2d::Vec2 &point2, cocos2d::Vec2 &point3);
|
|
|
|
|
cocos2d::Vec2 CC_STUDIO_DLL bezierTo(float t, cocos2d::Vec2 &point1, cocos2d::Vec2 &point2, cocos2d::Vec2 &point3, cocos2d::Vec2 &point4);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
2014-07-21 17:45:56 +08:00
|
|
|
|
cocos2d::Vec2 CC_STUDIO_DLL circleTo(float t, cocos2d::Vec2 ¢er, float radius, float fromRadian, float radianDif);
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
|
}
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
2013-06-07 10:52:32 +08:00
|
|
|
|
#endif /*__CCUTILMATH_H__*/
|