コード例 #1
0
 // operator* in this context means composition
 FgQuaternion
 operator*(const FgQuaternion &rhs) const
 {
     return FgQuaternion(
         m_real*(rhs.m_real) - fgDot(m_comp,rhs.m_comp),
         m_real*(rhs.m_comp) + (rhs.m_real)*m_comp + fgCrossProduct(m_comp,rhs.m_comp));
 }
コード例 #2
0
inline
double
pointToPlaneDistSqr(FgVect3D pnt,FgVect4D planeH)
{
    FgVect3D    planeN(planeH[0],planeH[1],planeH[2]);
    return (fgSqr(fgDot(pnt,planeN) + planeH[3]) / planeN.lengthSqr());
}
コード例 #3
0
typename FgTraits<T>::Accumulator
fgDot(
    const vector<FgMatrixC<T,nrows,ncols> > & v0,
    const vector<FgMatrixC<T,nrows,ncols> > & v1)
{
    FGASSERT(v0.size() == v1.size());
    typename FgTraits<T>::Accumulator acc(0);
    for (size_t ii=0; ii<v0.size(); ++ii)
        acc += fgDot(v0[ii],v1[ii]);
    return acc;
}
コード例 #4
0
FgMatrixV<T>
fgMatRandOrtho(uint dim)
{
    FGASSERT(dim > 1);
    FgMatrixV<T>    ret(dim,dim);
    for (uint row=0; row<dim; ++row) {
        FgMatrixV<T>    vec = fgMatRandNormal<T>(1,dim);
        for (uint rr=0; rr<row; ++rr) {
            FgMatrixV<T>    axis = ret.rowVector(rr);
            vec -=  axis * fgDot(vec,axis);
        }
        ret.setSubMat(row,0,fgNormalize(vec));
    }
    return ret;
}
コード例 #5
0
T
fgDot(const FgMatrixV<T> & lhs,const FgMatrixV<T> & rhs)
{return fgDot(lhs.m_data,rhs.m_data); }