コード例 #1
0
ファイル: Vector.cpp プロジェクト: ardneran/Framework
Vec3 pointFromPlanes(const Vec4& a, const Vec4& b, const Vec4& c) {
	const float den = scalarTripleProduct(a.project(), b.project(), c.project());
	if (den == 0.0f) {
		return Vec3::zero;
	} else {
		Vec3 res = cross(b.project(), c.project()) * a.w + cross(c.project(), a.project()) * b.w + cross(a.project(), b.project()) * c.w;
		return res * (-1.0f / den);
	}
}
コード例 #2
0
int main()
{
	printf("\n a = "); printVector(a);
	printf("\n b = "); printVector(b);
	printf("\n c = "); printVector(c);
	printf("\n a . b = %f",dotProduct(a,b));
	printf("\n a x b = "); printVector(crossProduct(a,b));
	printf("\n a . (b x c) = %f",scalarTripleProduct(a,b,c));
	printf("\n a x (b x c) = "); printVector(vectorTripleProduct(a,b,c));
	
	return 0;
}