本文整理汇总了C++中point_t::project_to_euclidian方法的典型用法代码示例。如果您正苦于以下问题:C++ point_t::project_to_euclidian方法的具体用法?C++ point_t::project_to_euclidian怎么用?C++ point_t::project_to_euclidian使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类point_t
的用法示例。
在下文中一共展示了point_t::project_to_euclidian方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mesh
// volume evaluation with partial derivatives
/* virtual */ void operator()(
/* pointer to first point in rowwise control point grid */
const_point_iterator points, /* order in u dir */
std::size_t order_u, /* order in v dir */
std::size_t order_v, /* order in w dir */
std::size_t order_w, /* u-parameter for point to evaluate */
value_type u, /* v-parameter for point to evaluate */
value_type v, /* w-parameter for point to evaluate */
value_type w, /* resulting point at [u,v,w] */
point_t& point, /* first partial derivative in u at [u,v,w] */
point_t& du, /* first partial derivative in v at [u,v,w] */
point_t& dv, /* first partial derivative in w at [u,v,w] */
point_t& dw) const {
pointmesh3d<point_t> mesh(points,
points + order_u * order_v * order_w,
order_u,
order_v,
order_w);
// transform control points to homogenous space
std::for_each(
mesh.begin(), mesh.end(), std::mem_fn(&point_t::project_to_homogenous));
// first decasteljau in u direction until only u-linear volume is left for u
for (std::size_t jv = 0; jv != order_v; ++jv) {
for (std::size_t jw = 0; jw != order_w; ++jw) {
for (std::size_t i = 0; i != order_u - 2; ++i) {
for (std::size_t j = 0; j != order_u - 1 - i; ++j) {
mesh(j, jv, jw) =
(value_type(1) - u) * mesh(j, jv, jw) + u * mesh(j + 1, jv, jw);
}
}
}
}
// secondly decasteljau in v direction until only uv-linear volume is left
for (std::size_t ju = 0; ju != 2; ++ju) {
for (std::size_t jw = 0; jw != order_w; ++jw) {
for (std::size_t i = 0; i != order_v - 2; ++i) {
for (std::size_t j = 0; j != order_v - 1 - i; ++j) {
mesh(ju, j, jw) =
(value_type(1) - v) * mesh(ju, j, jw) + v * mesh(ju, j + 1, jw);
}
}
}
}
// thirdly decasteljau until only trilinear volume is left
for (std::size_t ju = 0; ju != 2; ++ju) {
for (std::size_t jv = 0; jv != 2; ++jv) {
for (std::size_t i = 0; i != order_w - 2; ++i) {
for (std::size_t j = 0; j != order_w - 1 - i; ++j) {
mesh(ju, jv, j) =
(value_type(1) - w) * mesh(ju, jv, j) + w * mesh(ju, jv, j + 1);
}
}
}
}
// evaluate for u leaving a linear patch dependending on v,w
point_t vw00 = (value_type(1) - u) * mesh(0, 0, 0) + u * mesh(1, 0, 0);
point_t vw10 = (value_type(1) - u) * mesh(0, 1, 0) + u * mesh(1, 1, 0);
point_t vw01 = (value_type(1) - u) * mesh(0, 0, 1) + u * mesh(1, 0, 1);
point_t vw11 = (value_type(1) - u) * mesh(0, 1, 1) + u * mesh(1, 1, 1);
// evaluate for v leaving a linear patch dependending on u,w
point_t uw00 = (value_type(1) - v) * mesh(0, 0, 0) + v * mesh(0, 1, 0);
point_t uw10 = (value_type(1) - v) * mesh(1, 0, 0) + v * mesh(1, 1, 0);
point_t uw01 = (value_type(1) - v) * mesh(0, 0, 1) + v * mesh(0, 1, 1);
point_t uw11 = (value_type(1) - v) * mesh(1, 0, 1) + v * mesh(1, 1, 1);
// evaluating v,w plane for v resulting in last linear interpolation in w ->
// to compute first partial derivative in w
point_t w0 = (value_type(1) - v) * vw00 + v * vw10;
point_t w1 = (value_type(1) - v) * vw01 + v * vw11;
// evaluating v,w plane for w resulting in last linear interpolation in v ->
// to compute first partial derivative in v
point_t v0 = (value_type(1) - w) * vw00 + w * vw01;
point_t v1 = (value_type(1) - w) * vw10 + w * vw11;
// evaluating v,w plane for w resulting in last linear interpolation in v ->
// to compute first partial derivative in v
point_t u0 = (value_type(1) - w) * uw00 + w * uw01;
point_t u1 = (value_type(1) - w) * uw10 + w * uw11;
// last interpolation and back projection to euclidian space
point = (value_type(1) - w) * w0 + w * w1;
point.project_to_euclidian();
// M.S. Floater '91 :
//
// w[0]{n-1}(t) * w[1]{n-1}(t)
// P'(t) = n * --------------------------- * P[1]{n-1}(t) - P[0]{n-1}(t)
// w[0]{n})^2
//
// 1. recalculate overwritten helping point P[0, n-1]
// 2. project P[0, n-1] and P[1, n-1] into plane w=1
// 3. use formula above to find out the correct length of P'(t)
//.........这里部分代码省略.........