Esempio n. 1
0
void CStarCamera::fn2(FVector v1, FVector v2, FVector v3) {
	if (_matrixRow == -1) {
		FVector tempV;
		tempV._z = _viewport._field10;
		v3._z = v1._z;
		tempV._x = _viewport._centerVector._z * v1._y * v1._z / _viewport._centerVector._x;
		v3._y = _viewport._centerVector._y * tempV._z * v3._x / _viewport._centerVector._x;
		v3._x = _viewport._centerVector._y * v1._x * v1._z / _viewport._centerVector._x - _viewport._valArray[2];
		tempV._y = _viewport._centerVector._z * tempV._z * v3._y / _viewport._centerVector._x;
		tempV._x = tempV._x - _viewport._valArray[2];

		v3.normalize();
		tempV.normalize();

		FMatrix matrix = _viewport.getOrientation();
		const FVector &pos = _viewport._position;
		_mover->proc10(v3, tempV, pos, matrix);

		CStarVector *sv = new CStarVector(this, v2);
		_mover->setVector(sv);
	}
}
Esempio n. 2
0
FVector FVector::getAnglesAsVect() const {
	FVector vector = *this;
	FVector dest;

	if (!vector.normalize(dest._x)) {
		// Makes this vector have magnitude=1, put the scale amount in dest._x,
		// but if it is unsuccessful, crash
		assert(dest._x);
	}

	dest._y = acos(vector._y);	// radian distance/angle that this vector's y component is from the +y axis,
								// result is restricted to [0,pi]
	dest._z = atan2(vector._x,vector._z); // result is restricted to [-pi,pi]

	return dest;
}
Esempio n. 3
0
/*
 * Note - do not use - needs to be fixed
 */
bool C3ds::segInTriangle(FVector p, FVector d, FVector* v) {
  for (int j = 2, i = 0; i < 3; j = i, i++) {
    FVector e = v[i] - v[j];
    FVector h = p - v[j];
    FVector f = e % d;
    float dot = h * f;

    if (dot > 0.0f) {
      return false;
    }
  }
  FVector a = (v[1] - v[0]);
  FVector b = (v[2] - v[0]);
  FVector segNormal = (a % b).normalize();
  FVector proj = b.normalize();
  proj = a * (proj * proj);
  if (proj.magnitude() >= d.magnitude()) {
    std::cout << proj.magnitude() << std::endl;
    return true;
  } else
    return false;
}