本文整理汇总了C++中cVector类的典型用法代码示例。如果您正苦于以下问题:C++ cVector类的具体用法?C++ cVector怎么用?C++ cVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cVector类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TranslationMatrix
void cMatrix::TranslationMatrix (cVector vector)
{
Identity ();
m_fields[0][3] = vector.x ();
m_fields[1][3] = vector.y ();
m_fields[2][3] = vector.z ();
}
开发者ID:greeduomacro,项目名称:Iris1,代码行数:7,代码来源:Geometry.cpp
示例2: RotationMatrix
void cMatrix::RotationMatrix (cVector axis, float angle) // Creates a rotation matrix
{
float V[3];
int i;
axis.Normalize ();
for (i = 0; i < 3; i++)
V[i] = axis.field (i);
float c = cos (angle);
float c1 = 1.0f - c;
float s = sin (angle);
m_fields[0][0] = V[0] * V[0] * c1 + c;
m_fields[1][0] = V[0] * V[1] * c1 - V[2] * s;
m_fields[2][0] = V[0] * V[2] * c1 + V[1] * s;
m_fields[0][1] = V[1] * V[0] * c1 + V[2] * s;
m_fields[1][1] = V[1] * V[1] * c1 + c;
m_fields[2][1] = V[1] * V[2] * c1 - V[0] * s;
m_fields[0][2] = V[2] * V[0] * c1 - V[1] * s;
m_fields[1][2] = V[2] * V[1] * c1 + V[0] * s;
m_fields[2][2] = V[2] * V[2] * c1 + c;
m_fields[3][3] = 1.0f;
for (i = 0; i < 3; i++)
{ // fill rest with 0.0
m_fields[i][3] = 0.0f;
m_fields[3][i] = 0.0f;
}
}
开发者ID:greeduomacro,项目名称:Iris1,代码行数:34,代码来源:Geometry.cpp
示例3: ApplyRotation
cVector cMatrix::ApplyRotation (cVector vector)
{
cVector vectemp;
for (int i = 0; i < 3; i++)
vectemp.setField (i, m_fields[i][0] * vector.x () +
m_fields[i][1] * vector.y () +
m_fields[i][2] * vector.z ());
return vectemp;
}
开发者ID:greeduomacro,项目名称:Iris1,代码行数:9,代码来源:Geometry.cpp
示例4: setSpeed
void cCritterViewer::setViewpoint(cVector toviewer, cVector lookatpoint,
BOOL trytoseewholeworld)
{
//First do some default setup stuff
_fieldofviewangle = cCritterViewer::STARTFIELDOFVIEWANGLE;
setSpeed(0.0);
#ifndef THREEDVECTORS //not THREEDVECTORS means the 2D case.
_attitude = cMatrix(cVector2(1.0, 0.0), cVector2(0.0, 1.0), _position);
#else //THREEDVECTORS
_attitude = cMatrix(-cVector::ZAXIS, -cVector::XAXIS, cVector::YAXIS, cVector::ZEROVECTOR);
/* To get a reasonable default orientation, we arrange the viewer axes so that:
viewer x axis = world -z axis, viewer y axis = world -x axis, viewer z axis = world y axis.
We pick this orientation so that if the viewer moves "forward" (along its tangent vector)
it moves towards the world. (We correct the mismatch between the coordinate systems in the
cCritterViewer::loadViewMatrix method, which has a long comment about this.)
Note that we will adjust _position (fourth column) later in this call
with a moveTo, also we may rotate the _attitude a bit. */
if (!_perspective) //Ortho view, simply move up.
{
_proportionofworldtoshow = 1.0; //Show all of a flat world.
moveTo(lookatpoint + cCritterViewer::ORTHOZOFFSET * cVector::ZAXIS); // Get above the world
_maxspeed = _maxspeedstandard = 0.5 * cCritterViewer::ORTHOZOFFSET; //Mimic perspective case.
}
else //_perspective
{
if (toviewer.isPracticallyZero()) //Not usable, so pick a real direction.
toviewer = cVector::ZAXIS; //Default is straight up.
if (trytoseewholeworld) /* Treat toviewer as a direction, and back off in that direction
enough to see the whole world */
{
toviewer.normalize(); //Make it a unit vector.
_proportionofworldtoshow = cCritterViewer::PROPORTIONOFWORLDTOSHOW;
//Trying to show all of a world when flying around it, often leaves too big a space around it.
Real furthestcornerdistance = pgame()->border().maxDistanceToCorner(lookatpoint);
Real tanangle = tan(_fieldofviewangle/2.0); /* We work with half the fov in this calculation,
the tanangle will be the ratio of visible distance to distance above the world,
that is, tanangle = dr/dz, where
Our dr is _proportionofworldtoshow * furthestcornerdistance, and
our dz is the unknown seeallz height we need to back off to.
Swap tangangle and dz to get the next formula. */
ASSERT(tanangle);
Real seeallz = _proportionofworldtoshow * furthestcornerdistance / tanangle;
moveTo(lookatpoint + seeallz * toviewer);
}
else /*Not trytoseewholeworld. In this case we don't normalize toviewer, instead
we treat it as a displacment from the lookatpoint. */
moveTo(lookatpoint + toviewer);
lookAt(lookatpoint);
_maxspeed = _maxspeedstandard = 0.5 * (position()-lookatpoint).magnitude();
/* Define the speed like this so it typically takes two seconds (1/0.5)
to fly in to lookatpoint. */
_lastgoodplayeroffset = position() - pgame()->pplayer()->position();
}
#endif //THREEDVECTORS case
}
开发者ID:jstty,项目名称:OlderProjects,代码行数:55,代码来源:critterviewer.cpp
示例5: vectorToPixel
void cGraphicsMFC::vectorToPixel(cVector position, int &xpix, int &ypix, Real &zbuff)
{
/* I have to use a viewercorrection like in cGraphicsMFC::pixelToVector*/
int tempx, tempy;
cVector viewercorrection = _matrix.lastColumn();
position += viewercorrection;
_realpixelconverter.realToPixel(position.x(), position.y(), &tempx, &tempy);
xpix = tempx;
ypix = tempy;
zbuff = 0.0;
}
开发者ID:jstty,项目名称:OlderProjects,代码行数:11,代码来源:graphicsMFC.cpp
示例6: cVector
cVector cVector::cross(cVector& in){
sVector input = in.getVectorCoord();
cVector ret = cVector(((m_sVectorData->y * input.z) - (m_sVectorData->z * input.y)),
((m_sVectorData->z * input.x) - (m_sVectorData->x * input.z)),
((m_sVectorData->x * input.y) - (m_sVectorData->y * input.x)));
return ret;
}
开发者ID:arkiny,项目名称:Direct3D,代码行数:7,代码来源:cVector.cpp
示例7: AddExcludes
void AddExcludes(pxnode pExcludes, cVector<cDetectExclude>& excludes, const char* pszProfile)
{
if (!pExcludes)
return;
for (pxnode pExclude = pExcludes->first_child; pExclude; pExclude = pExclude->next)
{
if (pExclude->type != SBVT_STRING || !pExclude->pdata)
continue;
cStrObj path;
path.assign(pExclude->pdata, cCP_UNICODE, pExclude->data_size);
bool bFound = false;
for (tDWORD i = 0; i < excludes.size(); ++i)
{
cDetectExclude& exclude = excludes[i];
if (exclude.m_bEnable
&& (exclude.m_nTriggers & cDetectExclude::fObjectMask)
&& exclude.m_Object.m_strMask == path)
{
if (exclude.m_aTaskList.find(pszProfile) == exclude.m_aTaskList.npos)
exclude.m_aTaskList.push_back(pszProfile);
bFound = true;
break;
}
}
if (bFound)
continue;
cDetectExclude exclude;
exclude.m_nTriggers |= cDetectExclude::fTaskList;
exclude.m_Object.m_bRecurse = (!path.empty() && (path[path.length()-1] == '\\')) ? cTRUE : cFALSE;
exclude.m_Object.m_strMask = path;
exclude.m_aTaskList.push_back(pszProfile);
excludes.push_back(exclude);
}
}
开发者ID:hackshields,项目名称:antivirus,代码行数:38,代码来源:UpgradeFrom50.cpp
示例8: build_condensation
cVector build_condensation(const WorkSpaceGraph &graph) {
vVector top_sort = topolog_sort< WorkSpaceGraph >(graph);
in_sort.clear();
out_sort.clear();
used.clear();
std::for_each(top_sort.rbegin(), top_sort.rend(), [&cond, &used, &in_sort, this] (const Vertex &v) {
if (used.find(v) == used.end()) {
this->dfs< Transposed >(v);
cond.push_back(vSet(in_sort.begin(), in_sort.end()));
in_sort.clear();
}
});
return cond;
}
开发者ID:nukich74,项目名称:Project,代码行数:16,代码来源:graph.cpp
示例9: dot
float cVector::dot(cVector& in){
sVector input = in.getVectorCoord();
return (m_sVectorData->x * input.x) + (m_sVectorData->y * input.y) + (m_sVectorData->z*input.z);
}
开发者ID:arkiny,项目名称:Direct3D,代码行数:4,代码来源:cVector.cpp
示例10: equal
bool cVector::equal(cVector& in){
float origin = this->length();
float comp = in.length();
if ((origin - comp) * (origin - comp) <= EPSILON*EPSILON) return true;
else return false;
}
开发者ID:arkiny,项目名称:Direct3D,代码行数:6,代码来源:cVector.cpp
示例11: SetAcceleration
void cParticle::SetAcceleration (cVector vector)
{
vec_acc[0] = vector.x ();
vec_acc[1] = vector.y ();
vec_acc[2] = vector.z ();
}
开发者ID:BackupTheBerlios,项目名称:iris-svn,代码行数:6,代码来源:ParticleHandler.cpp
示例12: CrossProduct
void cVector::CrossProduct (cVector vector1, cVector vector2)
{
Set (vector1.y () * vector2.z () - vector1.z () * vector2.y (), // = x
vector1.z () * vector2.x () - vector1.x () * vector2.z (), // = y
vector1.x () * vector2.y () - vector1.y () * vector2.x () // = z
);
}
开发者ID:greeduomacro,项目名称:Iris1,代码行数:7,代码来源:Geometry.cpp
示例13: DotProduct
float cVector::DotProduct (cVector vector)
{
return x () * vector.x () + y () * vector.y () + z () * vector.z ();
}
开发者ID:greeduomacro,项目名称:Iris1,代码行数:4,代码来源:Geometry.cpp
示例14: Accelerate
void cParticle::Accelerate (cVector vector)
{
vec_speed[0] += vector.x ();
vec_speed[1] += vector.y ();
vec_speed[2] += vector.z ();
}
开发者ID:BackupTheBerlios,项目名称:iris-svn,代码行数:6,代码来源:ParticleHandler.cpp
示例15: Draw
void cDvbSubtitleBitmaps::Draw(cOsd *Osd)
{
bool Scale = !(DoubleEqual(osdFactorX, 1.0) && DoubleEqual(osdFactorY, 1.0));
bool AntiAlias = true;
if (Scale && osdFactorX > 1.0 || osdFactorY > 1.0) {
// Upscaling requires 8bpp:
int Bpp[MAXOSDAREAS];
for (int i = 0; i < numAreas; i++) {
Bpp[i] = areas[i].bpp;
areas[i].bpp = 8;
}
if (Osd->CanHandleAreas(areas, numAreas) != oeOk) {
for (int i = 0; i < numAreas; i++)
Bpp[i] = areas[i].bpp = Bpp[i];
AntiAlias = false;
}
}
if (Osd->SetAreas(areas, numAreas) == oeOk) {
for (int i = 0; i < bitmaps.Size(); i++) {
cBitmap *b = bitmaps[i];
if (Scale)
b = b->Scaled(osdFactorX, osdFactorY, AntiAlias);
Osd->DrawBitmap(int(round(b->X0() * osdFactorX)), int(round(b->Y0() * osdFactorY)), *b);
if (b != bitmaps[i])
delete b;
}
Osd->Flush();
}
}
开发者ID:Lexus34,项目名称:tdt-arp,代码行数:29,代码来源:dvbsubtitle.c
示例16: AddBitmap
void cDvbSubtitleBitmaps::AddBitmap(cBitmap *Bitmap)
{
bitmaps.Append(Bitmap);
}
开发者ID:Lexus34,项目名称:tdt-arp,代码行数:4,代码来源:dvbsubtitle.c
注:本文中的cVector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论