stuff
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -348,15 +348,16 @@ __host__ __device__ cumat3f cumat3f::operator*(const float &rhs)
|
|||||||
__host__ __device__ cumat3f cumat3f::operator/(const float &rhs)
|
__host__ __device__ cumat3f cumat3f::operator/(const float &rhs)
|
||||||
{
|
{
|
||||||
cumat3f ret;
|
cumat3f ret;
|
||||||
ret.m00 = m00 / rhs;
|
float irhs = 1.0f/rhs;
|
||||||
ret.m10 = m10 / rhs;
|
ret.m00 = m00 * irhs;
|
||||||
ret.m20 = m20 / rhs;
|
ret.m10 = m10 * irhs;
|
||||||
ret.m01 = m01 / rhs;
|
ret.m20 = m20 * irhs;
|
||||||
ret.m11 = m11 / rhs;
|
ret.m01 = m01 * irhs;
|
||||||
ret.m21 = m21 / rhs;
|
ret.m11 = m11 * irhs;
|
||||||
ret.m02 = m02 / rhs;
|
ret.m21 = m21 * irhs;
|
||||||
ret.m12 = m12 / rhs;
|
ret.m02 = m02 * irhs;
|
||||||
ret.m22 = m22 / rhs;
|
ret.m12 = m12 * irhs;
|
||||||
|
ret.m22 = m22 * irhs;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,17 +424,19 @@ __host__ __device__ cumat3f cumat3f::inverse()
|
|||||||
{
|
{
|
||||||
cumat3f q;
|
cumat3f q;
|
||||||
float dt = det();
|
float dt = det();
|
||||||
|
float idt;
|
||||||
if(dt!=0.0)
|
if(dt!=0.0)
|
||||||
{
|
{
|
||||||
q(0,0) = (at(1,1)*at(2,2)-at(1,2)*at(2,1))/dt;
|
idt = 1.0f/dt;
|
||||||
q(1,0) = -(at(1,0)*at(2,2)-at(1,2)*at(2,0))/dt;
|
q(0,0) = (at(1,1)*at(2,2)-at(1,2)*at(2,1))*idt;
|
||||||
q(2,0) = (at(1,0)*at(2,1)-at(1,1)*at(2,0))/dt;
|
q(1,0) = -(at(1,0)*at(2,2)-at(1,2)*at(2,0))*idt;
|
||||||
q(0,1) = -(at(0,1)*at(2,2)-at(0,2)*at(2,1))/dt;
|
q(2,0) = (at(1,0)*at(2,1)-at(1,1)*at(2,0))*idt;
|
||||||
q(1,1) = (at(0,0)*at(2,2)-at(0,2)*at(2,0))/dt;
|
q(0,1) = -(at(0,1)*at(2,2)-at(0,2)*at(2,1))*idt;
|
||||||
q(2,1) = -(at(0,0)*at(2,1)-at(0,1)*at(2,0))/dt;
|
q(1,1) = (at(0,0)*at(2,2)-at(0,2)*at(2,0))*idt;
|
||||||
q(0,2) = (at(0,1)*at(1,2)-at(0,2)*at(1,1))/dt;
|
q(2,1) = -(at(0,0)*at(2,1)-at(0,1)*at(2,0))*idt;
|
||||||
q(1,2) = -(at(0,0)*at(1,2)-at(0,2)*at(1,0))/dt;
|
q(0,2) = (at(0,1)*at(1,2)-at(0,2)*at(1,1))*idt;
|
||||||
q(2,2) = (at(0,0)*at(1,1)-at(0,1)*at(1,0))/dt;
|
q(1,2) = -(at(0,0)*at(1,2)-at(0,2)*at(1,0))*idt;
|
||||||
|
q(2,2) = (at(0,0)*at(1,1)-at(0,1)*at(1,0))*idt;
|
||||||
// q(0,0) = (at(1,1)*at(2,2)-at(1,2)*at(2,1))/dt;
|
// q(0,0) = (at(1,1)*at(2,2)-at(1,2)*at(2,1))/dt;
|
||||||
// q(0,1) = -(at(1,0)*at(2,2)-at(1,2)*at(2,0))/dt;
|
// q(0,1) = -(at(1,0)*at(2,2)-at(1,2)*at(2,0))/dt;
|
||||||
// q(0,2) = (at(1,0)*at(2,1)-at(1,1)*at(2,0))/dt;
|
// q(0,2) = (at(1,0)*at(2,1)-at(1,1)*at(2,0))/dt;
|
||||||
@ -511,15 +514,16 @@ __host__ __device__ cumat3f& cumat3f::operator-=(const cumat3f &rhs)
|
|||||||
|
|
||||||
__host__ __device__ cumat3f& cumat3f::operator/=(const float &rhs)
|
__host__ __device__ cumat3f& cumat3f::operator/=(const float &rhs)
|
||||||
{
|
{
|
||||||
m00 /= rhs;
|
float irhs = 1.0f/rhs;
|
||||||
m10 /= rhs;
|
m00 *= irhs;
|
||||||
m20 /= rhs;
|
m10 *= irhs;
|
||||||
m01 /= rhs;
|
m20 *= irhs;
|
||||||
m11 /= rhs;
|
m01 *= irhs;
|
||||||
m21 /= rhs;
|
m11 *= irhs;
|
||||||
m02 /= rhs;
|
m21 *= irhs;
|
||||||
m12 /= rhs;
|
m02 *= irhs;
|
||||||
m22 /= rhs;
|
m12 *= irhs;
|
||||||
|
m22 *= irhs;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user