本文整理汇总了C++中Vec::getY方法的典型用法代码示例。如果您正苦于以下问题:C++ Vec::getY方法的具体用法?C++ Vec::getY怎么用?C++ Vec::getY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vec
的用法示例。
在下文中一共展示了Vec::getY方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dotProd
GLdouble dotProd(const Vec &one, const Vec &two){
GLdouble x = (one.getX() * two.getX());
GLdouble y = (one.getY() * two.getY());
GLdouble z = (one.getZ() * two.getZ());
return (x + y + z);
}
示例2: Vec
/* Multiplication vector and matrix. (*this * v)
* ARGUMENTS:
* - vector to multiply from right
* Vec v;
* RETURNS:
* - result vector
* Vec;
*/
Vec Matrix::operator*( Vec &v )
{
Vec res = Vec(v.getX() * M[0][0] + v.getY() * M[1][0] + v.getZ() * M[2][0] + M[3][0],
v.getX() * M[0][1] + v.getY() * M[1][1] + v.getZ() * M[2][1] + M[3][1],
v.getX() * M[0][2] + v.getY() * M[1][2] + v.getZ() * M[2][2] + M[3][2]);
return res;
} /* End of 'operator*' function */
示例3: MultiplyVectorFromLeft
/* Multiplication vector and matrix. (vec * *this)
* ARGUMENTS:
* - vector to multiply from right
* Vec &v;
* RETURNS:
* - result vector
* Vec;
*/
Vec Matrix::MultiplyVectorFromLeft( Vec &v )
{
Vec res = Vec(v.getX() * M[0][0] + v.getY() * M[0][1] + v.getZ() * M[0][2] + M[0][3],
v.getX() * M[1][0] + v.getY() * M[1][1] + v.getZ() * M[1][2] + M[1][3],
v.getX() * M[2][0] + v.getY() * M[2][2] + v.getZ() * M[2][2] + M[2][3]);
return res;
} /* End of 'operator*' function */
示例4: crossProd
Vec crossProd(const Vec &one, const Vec &two){
GLdouble cp[3];
cp[0] = one.getY() * two.getZ() - two.getY() * one.getZ();
cp[1] = one.getZ() * two.getX() - two.getZ() * one.getX();
cp[2] = one.getX() * two.getY() - two.getX() * one.getY();
Vec result(cp[0], cp[1], cp[2]);
return result;
}
示例5: searchInternal
void KdTree::searchInternal(KdNode* node,const BBox& bb,int d,List<VecItem*>& items){
if( node ){
Vec pn = node->item->getPosition();
if( (d==0 && bb.getMinX()<pn.getX()) || bb.getMinY()<pn.getY() ){
searchInternal(node->left,bb,(d+1)%m_k,items);
}
if( bb.contains(pn) ){
items.append( node->item );
}
if( (d==0 && pn.getX()<=bb.getMaxX()) || pn.getY()<=bb.getMaxY() ){
searchInternal(node->right,bb,(d+1)%m_k,items);
}
}
}
示例6: if
//This function is stupid, I know.
//This is NOT a comparison of vector lengths!
//It needs to look this way for 'maps' to work...
bool Vec::operator<(const Vec vecA) const {
Vec tmp = vecA;
Vec tmp2 = *this;
if (tmp2.getX() < tmp.getX()) {
return true;
}
else if((tmp2.getX() == tmp.getX()) && (tmp2.getY() < tmp.getY())){
return true;
}
else if((tmp2.getX() == tmp.getX()) && (tmp2.getY() == tmp.getY()) && (tmp2.getZ() < tmp.getZ())){
return true;
}
else return false;
}
示例7:
Vec Vec::operator=(Vec vecA){
x = vecA.getX();
y = vecA.getY();
z = vecA.getZ();
return *this;
}
示例8:
Lighting::Lighting(Vec pos, Vec dir, char color, GLfloat spot, GLfloat intense, int lightNum, GLfloat colour[])
{
this->white[0] = 1.0;
this->white[1] = 1.0;
this->white[2] = 1.0;
this->white[3] = 1.0;
this->red[0] = 1.0;
this->red[1] = 0.0;
this->red[2] = 0.0;
this->red[3] = 1.0;
this->green[0] = 0.0;
this->green[1] = 1.0;
this->green[2] = 0.0;
this->green[3] = 1.0;
this->blue[0] = 0.0;
this->blue[1] = 0.0;
this->blue[2] = 1.0;
this->blue[3] = 1.0;
this->other[0] = colour[0];
this->other[1] = colour[1];
this->other[2] = colour[2];
this->other[3] = colour[3];
this->position[0] = pos.getX();
this->position[1] = pos.getY();
this->position[2] = pos.getZ();
this->position[3] = 1.0;
this->direction[0] = dir.getX();
this->direction[1] = dir.getY();
this->direction[2] = dir.getZ();
this->fSpotLight = spot;
this->spotIntensity = intense;
this->init(color, lightNum);
}
示例9: CreateRotation
/* Create rotation Matrix.
* ARGUMENTS:
* - rotation angle in degrees
* float angle;
* - rotation vector
* Vec radVec;
* RETURNS:
* - rotation matrix
* Matrix ;
*/
Matrix CreateRotation( float angle, Vec &radVec )
{
Matrix rot;
/**/float si = sin(D2R(angle)), co = cos(D2R(angle)), len,
radX = radVec.getX(), radY = radVec.getY(), radZ = radVec.getZ();
len = !radVec;
if (len == 0)
len = 1;
radX /= len;
radY /= len;
radZ /= len;
rot.SetElement(0, 0, co + radX * radX * (1 - co));
rot.SetElement(0, 1, radX * radY * (1 - co) - radZ * si);
rot.SetElement(0, 2, radX * radZ * (1 - co) + radY * si);
rot.SetElement(1, 0, radX * radY * (1 - co) + radZ * si);
rot.SetElement(1, 1, co + radY * radY * (1 - co));
rot.SetElement(1, 2, radZ * radY * (1 - co) - radX * si);
rot.SetElement(2, 0, radX * radZ * (1 - co) - radY * si);
rot.SetElement(2, 1, radZ * radY * (1 - co) + radX * si);
rot.SetElement(2, 2, co + radZ * radZ * (1 - co));/*
float si = sin(D2R(angle / 2)), co = cos(D2R(angle / 2)), len, // ÏÎËÎÂÈÍÍÛÉ ÓÃÎË!!!
radX = radVec.getX(), radY = radVec.getY(), radZ = radVec.getZ();
len = !radVec;
if (len == 0)
len = 1;
radX *= si / len;
radY *= si / len;
radZ *= si / len;
rot.SetElement(0, 0, 1 - 2 * (radY * radY + radZ * radZ));
rot.SetElement(0, 1, 2 * radX * radY - 2 * co * radZ);
rot.SetElement(0, 2, 2 * co * radY + 2 * radX * radZ);
rot.SetElement(1, 0, 2 * radX * radY + 2 * co * radZ);
rot.SetElement(1, 1, 1 - 2 * (radX * radX + radZ * radZ));
rot.SetElement(1, 2, 2 * radY * radZ - 2 * co * radX);
rot.SetElement(2, 0, 2 * radX * radZ - 2 * co * radY);
rot.SetElement(2, 1, 2 * co * radX + 2 * radY * radZ);
rot.SetElement(2, 2, 1 - 2 * (radX * radX + radY * radY));/**/
return rot;
} /* End of 'CreateRotation' function */
示例10: dot
GLdouble Vec::dot( const Vec &other ) const
{
return (getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ());
}
示例11: result
Vec Vec::operator+ ( const Vec &other ) const
{
Vec result(this->x + other.getX(), this->y + other.getY(), this->z + other.getZ());
return result;
}
示例12: newVec
Vec Vec::operator+(Vec vecA){
Vec newVec(vecA.getX()+this->getX(),vecA.getY()+this->getY(),vecA.getZ()+this->getZ());
return newVec;
}
示例13: set
void Vec::set( const Vec &other )
{
this->x = other.getX();
this->y = other.getY();
this->z = other.getZ();
}
示例14:
void Vec::operator= ( Vec other )
{
this->x = other.getX();
this->y = other.getY();
this->z = other.getZ();
}