10 #include <boost/static_assert.hpp>
19 const std::string
base::TypeNames[] = {
"r3",
"r3xs2",
"r3xs2p",
"se3" };
28 void se3::assertConsistency()
const
32 la::check(
ori_, __FUNCTION__);
38 std::ostream& se3::print(std::ostream &out)
const
41 idt <<
"Kernel SE(3): [ weight = " << w_ <<
" ]" << std::endl;
44 idt2 <<
"Location: " <<
loc_ << std::endl;
45 idt2 <<
"LocWidth: " <<
loc_h_ << std::endl;
46 idt2 <<
"Orientation: ";
47 ::nuklei::operator<<(idt2,
ori_) << std::endl;
48 idt2 <<
"OriWidth: " <<
ori_h_ << std::endl;
71 if (hasDescriptor()) s.setDescriptor(getDescriptor());
85 if (hasDescriptor()) k.setDescriptor(getDescriptor());
89 kernel::se3 se3::projectedOn(
const kernel::se3& k)
const
93 if (hasDescriptor()) p.setDescriptor(getDescriptor());
97 kernel::se3 se3::transformedWith(
const kernel::se3& k)
const
101 if (hasDescriptor()) p.setDescriptor(getDescriptor());
105 void se3::makeTransformWith(
const kernel::se3& k)
110 kernel::se3 se3::transformationFrom(
const kernel::se3& k)
const
114 if (hasDescriptor()) p.setDescriptor(getDescriptor());
118 kernel::se3 se3::inverseTransformation()
const
121 kernel::se3 it = origin.transformationFrom(*
this);
122 if (hasDescriptor()) it.setDescriptor(getDescriptor());
127 kernel::se3::linearInterpolation(
const kernel::se3& k,
132 i.loc_ = (1-x) * loc_ + x * k.loc_;
133 Quaternion q = k.ori_;
134 if (ori_.Dot(q) < 0) q = - q;
136 i.ori_ = (1-x) * ori_ + x * q;
141 void kernel::se3::updateWidth(
const kernel::se3& k,
144 loc_h_ = std::sqrt( (1-x) * loc_h_*loc_h_ +
145 x * std::pow(dist<groupS::r3>::d(loc_, k.loc_), 2) );
146 ori_h_ = std::sqrt( (1-x) * ori_h_*ori_h_ +
147 x * std::pow(dist<groupS::so3>::d(ori_, k.ori_), 2) );
150 coord_pair kernel::se3::distanceTo(
const kernel::se3& k)
const
152 return std::make_pair(dist<groupS::r3>::d(loc_, k.loc_),
153 dist<groupS::so3>::d(ori_, k.ori_));
160 void r3::assertConsistency()
const
162 NUKLEI_TRACE_BEGIN();
168 std::ostream& r3::print(std::ostream &out)
const
171 idt <<
"Kernel R^3: [ weight = " << w_ <<
" ]" << std::endl;
174 idt2 <<
"Location: " << loc_ << std::endl;
175 idt2 <<
"LocWidth: " << loc_h_ << std::endl;
194 s.loc_ = PositionSampler::s(loc_, loc_h_);
196 if (hasDescriptor()) s.setDescriptor(getDescriptor());
204 se3k.
loc_ = r3k.loc_;
206 if (hasDescriptor()) se3k.setDescriptor(getDescriptor());
214 se3k.
loc_ = r3k.loc_;
216 if (hasDescriptor()) se3k.setDescriptor(getDescriptor());
220 kernel::r3 r3::projectedOn(
const kernel::se3& k)
const
224 if (hasDescriptor()) p.setDescriptor(getDescriptor());
228 kernel::r3 r3::transformedWith(
const kernel::se3& k)
const
232 if (hasDescriptor()) p.setDescriptor(getDescriptor());
236 void r3::makeTransformWith(
const kernel::se3& k)
242 kernel::r3::linearInterpolation
243 (
const kernel::r3& k,
248 i.loc_ = (1-x) * loc_ + x * k.loc_;
252 void kernel::r3::updateWidth(
const kernel::r3& k,
255 loc_h_ = std::sqrt( (1-x) * loc_h_*loc_h_ +
256 x * std::pow(dist<groupS::r3>::d(loc_, k.loc_), 2) );
260 kernel::r3::distanceTo(
const kernel::r3& k)
const
262 return std::make_pair(dist<groupS::r3>::d(loc_, k.loc_), -1.);
267 namespace enforce_data_align {
269 BOOST_STATIC_ASSERT(
sizeof(kernel::base) % 8 == 0);
275 #if BOOST_VERSION < 104100
278 BOOST_CLASS_EXPORT_GUID(
nuklei::kernel::
r3xs2, "mdfh_kernel_r3xs2")
279 BOOST_CLASS_EXPORT_GUID(
nuklei::kernel::
r3xs2p, "mdfh_kernel_r3xs2p")
280 BOOST_CLASS_EXPORT_GUID(
nuklei::kernel::r3, "mdfh_kernel_r3")
289 #endif // BOOST_VERSION