1 #pragma once//©SDXFramework http://sourceforge.jp/projects/dxframework/
25 static bool RectRect(
double x1 ,
double y1 ,
double x2 ,
double y2 ,
double x3 ,
double y3 ,
double x4 ,
double y4)
30 if ((x1 < x3 && x1 < x4) || (x2 > x3 && x2 > x4))
37 if ((x2 < x3 && x2 < x4) || (x1 > x3 && x1 > x4))
45 if ((y1 < y3 && y1 < y4) || (y2 > y3 && y2 > y4))
52 if ((y2 < y3 && y2 < y4) || (y1 > y3 && y1 > y4))
62 static bool LineLine(
double x1 ,
double y1 ,
double x2 ,
double y2 ,
double x3 ,
double y3 ,
double x4 ,
double y4)
65 if ((
double(x1 - x2) * (y3 - y1) + (y1 - y2) * (x1 - x3)) *
66 (
double(x1 - x2) * (y4 - y1) + (y1 - y2) * (x1 - x4)) > 0)
71 if ((
double(x3 - x4) * (y1 - y3) + (y3 - y4) * (x3 - x1)) *
72 (
double(x3 - x4) * (y2 - y3) + (y3 - y4) * (x3 - x2)) > 0)
81 static int PointPoint(
double x1 ,
double y1 ,
double x2 ,
double y2)
83 return int((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
93 virtual bool Hit(
const IShape *IShape)
const = 0;
94 virtual bool Hit(
const Complex *complex)
const = 0;
95 virtual bool Hit(
const Point *point)
const = 0;
96 virtual bool Hit(
const Line *line)
const = 0;
97 virtual bool Hit(
const Rect *rect)
const = 0;
98 virtual bool Hit(
const Circle *circle)
const = 0;
101 virtual void SetPos(
double X座標 ,
double Y座標) = 0;
104 virtual IShape*
Clone(
double x ,
double y)
const = 0;
119 virtual void MultiZoom(
double X倍率 ,
double Y倍率) = 0;
122 virtual void Move(
double X移動量 ,
double Y移動量) = 0;
127 Move( 距離 * cos(方向) , 距離 * sin(方向) );
131 virtual void Draw(
Color 描画色 ,
int 透過率 ,
Camera *座標変換Camera =
nullptr)
const = 0;
134 virtual void Rotate(
double 回転する角度) = 0;
137 virtual void SetAngle(
double 指定角度) = 0;
148 const double xd = this->
GetX() - 比較対象->
GetX();
149 const double yd = this->
GetY() - 比較対象->
GetY();
151 return sqrt( xd * xd + yd * yd );
155 virtual double GetX()
const = 0;
158 virtual double GetY()
const = 0;
161 virtual double GetW()
const = 0;
164 virtual double GetH()
const = 0;
virtual void Draw(Color 描画色, int 透過率, Camera *座標変換Camera=nullptr) const =0
描画する.
virtual IShape * Clone(double x, double y) const =0
同じ形の図形を作る.
virtual double GetY() const =0
Y座標を取得.
static int PointPoint(double x1, double y1, double x2, double y2)
二点間の距離を計算.
Definition: IShape .h:81
位置情報を持つ図形の抽象クラス.
Definition: IShape .h:18
void MoveA(double 距離, double 方向)
極座標で移動.
Definition: IShape .h:125
virtual double GetW() const =0
幅を取得.
double GetDirect(IShape *比較対象)
対象との角度を取得.
Definition: IShape .h:140
色を表すクラス.
Definition: Color.h:7
double GetDistance(IShape *比較対象)
対象との相対座標を取得.
Definition: IShape .h:146
virtual void Rotate(double 回転する角度)=0
回転する.
virtual bool Hit(const IShape *IShape) const =0
衝突判定.
static bool LineLine(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
線分の交差判定.
Definition: IShape .h:62
void SetZoom(double X拡大率, double Y拡大率)
拡大率を設定.
Definition: IShape .h:107
virtual double GetX() const =0
X座標を取得.
virtual void SetAngle(double 指定角度)=0
角度を指定する.
2D用に座標変換を行うカメラを表すクラス.
Definition: Camera.h:16
virtual void SetPos(double X座標, double Y座標)=0
指定座標に移動.
virtual double GetH() const =0
高さを取得.
static bool RectRect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
矩形の交差判定.
Definition: IShape .h:25
virtual void Move(double X移動量, double Y移動量)=0
相対座標で移動.
void MultiZoom(double 倍率)
拡大率を掛け算する.
Definition: IShape .h:113