Question

I'm trying to get my light vector the math formula is

float3 l_ik = p_light - focus / || p_light - focus || 

To get the value for || p_light - focus || is used the normalize() function from cv then I tried to simple calculate A / ||B|| therefore I tried to see the formula as

A / B <=> A * B^(-1) 
in c++:
  float3 l_ik = (p_light - focus) * ( normalize(p_light,focus)^(-1))

which results to a no match for 'operator^' in 'math::operator*(...). This means there is a no implement for this operator, or what? or is it not possible to calculate vectors ^(-1)

thx for any help.

Was it helpful?

Solution

^ is the 'xor' operator in c++, not what you expected. pow(some_mat, number); seems more appropriate

also normalize() is used to make a unit vector, and takes a src and a dst Mat, instead you probably wanted norm(p_light - focus); // the norm of the diff


(can it be you meant opengl, not opencv ?)


[edit]

was pretty blind yesterday, your formula is just the unit-length (p_light - focus) vector, so :

Vec3f v = p_light - focus;
Vec3f l_ik = v / norm(v);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top