Ejemplo n.º 1
0
	vec2& vec2::Normalize()
	{
		float lenght = Lenght();
		x = x / lenght;
		y = y / lenght;
		return *this;
	}
Ejemplo n.º 2
0
	vec3& vec3::Normalize()
	{
		float lenght = Lenght();
		x = x / lenght;
		y = y / lenght;
		z = z / lenght;
		return *this;
	}
Ejemplo n.º 3
0
MathUtils::Wvector MathUtils::Wvector::PerpendicularVec()
{
    cv::Point2f newEnd;
    newEnd.x = end.x;
    if (begin.y != end.y)
        newEnd.y = begin.y - (end.x - begin.x)*(end.x - begin.x) / (end.y - begin.y);
    else
        newEnd.y = end.y + Lenght();
    return Wvector(begin, newEnd);
}
Ejemplo n.º 4
0
MathUtils::Wvector MathUtils::Wvector::ÑodirectionalVec(double lenght)
{
    Wvector outVec;
    double oldLenght = Lenght();
    double dx = lenght * (end.x - begin.x) / oldLenght;
    double dy = lenght * (end.y - begin.y) / oldLenght;
    outVec.begin = begin;
    outVec.end = begin + cv::Point2f(dx, dy);
    return outVec;
}
Ejemplo n.º 5
0
Vector3d Vector3d::Normalize() const
{
    return ( (*this) / Lenght() );
}
Ejemplo n.º 6
0
Vec4& Vec4::Normalize() {
	float scale = 1.0f / (Lenght());
	(*this) *= scale;

	return *this;
}