本文整理汇总了C++中MyVector::DotProduct方法的典型用法代码示例。如果您正苦于以下问题:C++ MyVector::DotProduct方法的具体用法?C++ MyVector::DotProduct怎么用?C++ MyVector::DotProduct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyVector
的用法示例。
在下文中一共展示了MyVector::DotProduct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddEdgeToList
/**********************************************************
*
* AddEdgeToList
*
* parameters IN:
* VertexCell * vertex1
* VertexCell * vertex2
*
*********************************************************/
void AddEdgeToList (VertexCell * vertex1, VertexCell * vertex2)
{
VertexCell * tempVertex;
MyVector dw;
EdgeBox * edgeBox;
if (vertex1->screenPos.GetY() > vertex2->screenPos.GetY()) {
tempVertex = vertex1;
vertex1 = vertex2;
vertex2 = tempVertex;
}
int y1 = vertex1->screenPos.GetY();
int y2 = vertex2->screenPos.GetY();
if (y1 != y2) {
int dy = y2 - y1;
double currX = vertex1->screenPos.GetX();
double currZ = vertex1->screenPos.GetZ();
double currI = lightVector.DotProduct (vertex1->vertexNormal);
MyVector currW = vertex1->worldPos;
double dx = (vertex2->screenPos.GetX() - currX) / dy;
double dz = (vertex2->screenPos.GetZ() - currZ) / dy;
double di = (lightVector.DotProduct (vertex2->vertexNormal) - currI) / dy;
dw.SetX( (vertex2->worldPos.GetX() - currW.GetX()) / dy);
dw.SetY( (vertex2->worldPos.GetY() - currW.GetY()) / dy);
dw.SetZ( (vertex2->worldPos.GetZ() - currW.GetZ()) / dy);
for (int y = y1; y <= y2 - 1; y++) {
edgeBox = new EdgeBox;
edgeBox->x = currX;
edgeBox->z = (int)currZ;
edgeBox->i = currI;
edgeBox->w = currW;
edgeBox->next = edgeListAt[y];
edgeListAt[y] = edgeBox;
currX += dx;
currZ += dz;
currI += di;
currW.SetX( currW.GetX() + dw.GetX());
currW.SetY( currW.GetY() + dw.GetY());
currW.SetZ( currW.GetZ() + dw.GetZ());
}
}
}