예제 #1
0
Vector3DEx Vector3DEx::normalize()
{
	float vecMag = length();
	if ( vecMag == 0.0 )
	{
		return Vector3DEx(1.0,0,0);
	}
	return Vector3DEx(_x /= vecMag,_y /= vecMag,_z /= vecMag);
}
예제 #2
0
void Sculpture::initGrid(GRIDCELL& grid, double x, double y, double z) {
    double left = x,right = x + 1,top = y + 1,bot = y,near = z,far = z + 1;

    (grid.val)[0] = this->getBit(  left,    bot,    near );
    (grid.val)[1] = this->getBit(  left,    bot,    far  );
    (grid.val)[2] = this->getBit(  right,   bot,    far  );
    (grid.val)[3] = this->getBit(  right,   bot,    near );
    (grid.val)[4] = this->getBit(  left,    top,    near );
    (grid.val)[5] = this->getBit(  left,    top,    far  );
    (grid.val)[6] = this->getBit(  right,   top,    far  );
    (grid.val)[7] = this->getBit(  right,   top,    near );
    
    (grid.p)[0] = Vector3DEx(  left,    bot,    near    );
    (grid.p)[1] = Vector3DEx(  left,    bot,    far     );
    (grid.p)[2] = Vector3DEx(  right,   bot,    far     );
    (grid.p)[3] = Vector3DEx(  right,   bot,    near    );
    (grid.p)[4] = Vector3DEx(  left,    top,    near    );
    (grid.p)[5] = Vector3DEx(  left,    top,    far     );
    (grid.p)[6] = Vector3DEx(  right,   top,    far     );
    (grid.p)[7] = Vector3DEx(  right,   top,    near    );
}
예제 #3
0
Vector3DEx Vector3DEx::operator * (float alpha) const
{
	return Vector3DEx(_x*alpha,_y*alpha,_z*alpha);
}