Example #1
0
toxi::geom::Vec3D toxi::geom::Vec2D::bisect( Vec2D b )
{
	Vec2D diff = this->sub(b);
	Vec2D sum = this->add(b);
	float dot = diff.dot(sum);
	return Vec3D(diff.x, diff.y, -dot / 2)
}
Example #2
0
// n.projection(m) = m, m.reverseProjection(n.unit()) = n
Vec2D Vec2D::reverseProjection(const Vec2D &other) const
{
  Vec2D nu = other.unit();
  float l = length();
  return nu.scalei(l / nu.dot(scale(1.0f/l)));
}
Example #3
0
Vec2D &Vec2D::reverseProjectioni(const Vec2D &other)
{
  Vec2D nu = other.unit();
  float l = length();
  return assign(nu.scalei(l / nu.dot(scalei(1.0f/l))));
}