本文整理汇总了C++中Point::GetY方法的典型用法代码示例。如果您正苦于以下问题:C++ Point::GetY方法的具体用法?C++ Point::GetY怎么用?C++ Point::GetY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point::GetY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDeviationAngle
double Line::GetDeviationAngle(const Line &l) const {
// const double PI = 3.14159258;
#define DEBUG 0
Point P = _point1;
Point Goal = _point2;
Point L = l._point1;
Point R = l._point2;
double dist_Goal_L = (Goal - L).NormSquare();
double dist_Goal_R = (Goal - R).NormSquare();
double angle, angleL, angleR;
// we don't need to calculate both angles, but for debugging purposes we do it.
angleL = atan((Goal - P).CrossProduct(L - P) / (Goal - P).ScalarProduct(L - P));
angleR = atan((Goal - P).CrossProduct(R - P) / (Goal - P).ScalarProduct(R - P));
angle = (dist_Goal_L < dist_Goal_R) ? angleL : angleR;
#if DEBUG
printf("Enter GetAngel()\n");
printf("\tP=[%f,%f]\n",P.GetX(), P.GetY());
printf("\tGoal=[%f,%f]\n",Goal.GetX(), Goal.GetY());
printf("\tL=[%f,%f]\n",L.GetX(), L.GetY());
printf("\tR=[%f,%f]\n",R.GetX(), R.GetY());
printf("\t\tdist_Goal_L=%f\n",dist_Goal_L);
printf("\t\tdist_Goal_R=%f\n",dist_Goal_R);
printf("\t\t --> angleL=%f\n",angleL);
printf("\t\t --> angleR=%f\n",angleR);
printf("\t\t --> angle=%f\n",angle);
printf("Leave GetAngel()\n");
#endif
return angle;
}
示例2: Hits
// ------------------------------------------------------------------------------------------------------ PUBLIC METHODS
//Public methods
const bool Rectangle::Hits(Point aPoint)
{
return(
((aPoint.GetX()>=points[0].GetX() && aPoint.GetX()<=points[1].GetX()) || (aPoint.GetX()<=points[0].GetX() && aPoint.GetX()>=points[1].GetX()))
&&
((aPoint.GetY()>=points[0].GetY() && aPoint.GetY()<=points[1].GetY()) || (aPoint.GetY()<=points[0].GetY() && aPoint.GetY()>=points[1].GetY()))
);
}
示例3: fncomp
bool fncomp (Point lhs, Point rhs)
{if(lhs.GetX()<rhs.GetX())return true;
else if(lhs.GetX()==rhs.GetX())
{
if(lhs.GetY()<rhs.GetY())return true;
else return false;
}
else return false;
}
示例4: DrawWall
void DrawWall(Point color, Point a, Point b, Point c, Point d)
{
GLfloat mat_amb_diff[] = { color.GetX(), color.GetY(), color.GetZ(), 1.0 };
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_amb_diff);
glBegin(GL_QUADS);
glVertex3f(a.GetX(), a.GetY(), a.GetZ());
glVertex3f(b.GetX(), b.GetY(), b.GetZ());
glVertex3f(c.GetX(), c.GetY(), c.GetZ());
glVertex3f(d.GetX(), d.GetY(), d.GetZ());
glEnd();
}
示例5: Contains
bool Rectangle::Contains(const Point& point) const
{
if((point.GetX() >= GetX()) && (point.GetX() <= (GetX() + GetWidth())))
{
if((point.GetY() >= GetY()) && (point.GetY() <= (GetY() + GetHeight())))
{
return true;
}
}
return false;
}
示例6: intersect
Point intersect(float t, Point A, Point B)
{
// [AB] : Q(t) = (1 - t)A + tB, 0 <= t <= 1
Point I;
Point tmpA = Point((1 - t) * A.GetX(), (1 - t) * A.GetY());
Point tmpB = Point(t * B.GetX(), t * B.GetY());
I = tmpA + tmpB;
return I;
}
示例7: RotateSecondPoint
void MCircle::RotateSecondPoint(Point i_center, double i_angle)
{
double pi = 3.141592654;
double angle = (i_angle)* (pi / 180);
double rotated_x = cos(angle) * (m_second_point.GetX() - i_center.GetX()) -
sin(angle) * (m_second_point.GetY() - i_center.GetY()) + i_center.GetX();
double rotated_y = sin(angle) * (m_second_point.GetX() - i_center.GetX()) +
cos(angle) * (m_second_point.GetY() - i_center.GetY()) + i_center.GetY();
m_second_point.SetX(rotated_x);
m_second_point.SetY(rotated_y);
}
示例8: Appartient
bool Rectangle::Appartient( Point p)
// Algorithme :
//
{
if ( p.GetX() >= listePoints.front().GetX() && p.GetX() <= listePoints.back().GetX()
&& p.GetY() >= listePoints.front().GetY() && p.GetY() <= listePoints.back().GetY())
{
return true;
}
else
{
return false;
}
} //----- Fin de Appartient
示例9: SetPoint
void Point::SetPoint(Point point)
{
float x = point.GetX();
float y = point.GetY();
SetPoint(x, y);
}
示例10: main
void main()
{
Point a;
Point b(2, 3);
cout << a.GetX() << " " << a.GetY() << endl;
cout << b.GetX() << " " << b.GetY() << endl;
a.SetX(9);
a.SetY(-9);
cout << a.GetX() << " " << a.GetY() << endl;
Point * p = new Point(1, 7);
cout << p->GetX() << " " << p->GetY() << endl;
delete p;
}
示例11:
TEST(PointTest, TranslateYMovesPointInNegativeYDirection)
{
Point p;
p.TranslateY(-2);
EXPECT_EQ(0, p.GetX());
EXPECT_EQ(-2, p.GetY());
}
示例12: Appartient
bool Segment::Appartient( Point p )
// Algorithme :
// On vérifie que les extrémités du segment et p sont alignés (produit vectoriel),
// puis que p se trouve bien entre elles (produit scalaire + vérification de norme).
{
// On définit des "points" représentant en fait les coodonnées de vecteurs
// utilisés pour le calcul
Point petitX_grandX = Point(
listePoints.back().GetX() - listePoints.front().GetX(),
listePoints.back().GetY() - listePoints.front().GetY() );
Point petitX_p = Point( p.GetX() - listePoints.front().GetX(),
p.GetY() - listePoints.front().GetY() );
int comparaisonNormesCarrees = petitX_grandX.GetX() * petitX_grandX.GetX()
+ petitX_grandX.GetY() * petitX_grandX.GetY()
- petitX_p.GetX() * petitX_p.GetX()
- petitX_p.GetY() * petitX_p.GetY();
if ( petitX_grandX.ProduitVectoriel( petitX_p ) == 0
&& petitX_grandX.ProduitScalaire( petitX_p ) >= 0
&& comparaisonNormesCarrees >= 0 )
{
return true;
}
else
{
return false;
}
} //----- Fin de Appartient
示例13: EqualPoints
bool Point::EqualPoints(Point point)
{
float x = point.GetX();
float y = point.GetY();
if (x == mX && y == mY) return true;
return false;
}
示例14: Distance
float Point::Distance(Point point)
{
float x = DistanceX(point.GetX());
float y = DistanceY(point.GetY());
y = abs(y);
x = abs(x);
return max(y, x);
}
示例15: main
int main()
{
srand(time(NULL));
long n;
Point* p;
cout << "Enter number of points\n";
cin >> n;
cout << "Creating random points\n";
vector<Point*> PList(0);
for (long i = 0; i < n; i++)
{
//p = new Point((((double)(rand() % 2000))/10 - 100) ,(((double)(rand() % 2000))/10 - 100));
p=new Point((i*5)%97,(i*97)%87);
PList.push_back(p);
}
KDTNode* root = BuildKDT(PList,0);
PrintKDT(root);
cout<<"\nTree is Constructed\n";
cout << "Enter point to find nearest neighbour" << endl;
double x,y;
cout <<"X: ";
cin >> x;
cout << "Y: ";
cin >> y;
Point* NN = NearestNew(Point(x,y),root);
printf("Nearest Neighbours Found is: (%3.1f,%3.1f)\n ",NN->GetX(),NN->GetY());
Divider Rroot(Point(-101,-101),Point(101,101));
Circle CSearch(40.0,Point(40,40));
Region* Reg= &CSearch;
vector<Point>thisans;
SearchKDT(root,Rroot,0,Reg,thisans);
cout<<"Sample search yields:\n";printvector(thisans);
vector<Point> ans;
Region* Re;
cout<<"\n\nEnter Region to be searched\n0:Rectangle \n1:Circle\n";
int flag;cin>>flag;
if(flag==0)
{cout<<"\nEnter Coordiates of LowerLeft And UpperRight points of Rectangle\n";
double x1,y1,x2,y2;
cout<<"LowerLeft corner\n";
cout <<"X: ";
cin>>x1;
cout<<"Y: ";
cin>>y1;
cout<<"UpperRight corner\n";
cout <<"X: ";
cin>>x2;
cout<<"Y: ";
cin>>y2;
Re = new Rectangle(Point(x1,y1),Point(x2,y2));
}