Commit f89278cf authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Fix a bug in conversions from vec to point.

	* milena/mln/core/concept/gpoint.hh: Fix comment.

	* milena/mln/core/image/image1d.hh: Share a dpoint value.

	* milena/mln/core/point.hh: Handle point1d.
parent 3ca05868
2010-06-18 Guillaume Lazzara <z@lrde.epita.fr>
Fix a bug in conversions from vec to point.
* milena/mln/core/concept/gpoint.hh: Fix comment.
* milena/mln/core/image/image1d.hh: Share a dpoint value.
* milena/mln/core/point.hh: Handle point1d.
2010-06-15 Guillaume Lazzara <z@lrde.epita.fr>
 
Introduce labeling::value_and_compute.
......@@ -182,7 +182,7 @@ namespace mln
* topology and with the same type of coordinates; otherwise this
* test does not compile.
*
* \post The result, \p dp, is such as \p lhs == \p rhs + \p dp.
* \post The result, \p dp, is such as \p lhs == \p rhs + \p dp.
*
* \return A delta point (temporary object).
*
......
......@@ -304,8 +304,10 @@ namespace mln
void
data< image1d<T> >::update_vb_()
{
vb_.pmin() = b_.pmin() - dpoint1d(all_to(bdr_));
vb_.pmax() = b_.pmax() + dpoint1d(all_to(bdr_));
dpoint1d dp(all_to(bdr_));
vb_.pmin() = b_.pmin() - dp;
vb_.pmax() = b_.pmax() + dp;
}
template <typename T>
......
......@@ -353,10 +353,16 @@ namespace mln
point<G,C>::point(const algebra::vec<dim,double>& v)
{
unsigned j = 0;
for (unsigned i = dim - 2; i < dim; ++i)
coord_[i] = round(v[j++]);
for (unsigned i = 2; i < dim; ++i, ++j)
coord_[i-j] = round(v[j]);
//FIXME: to be improved while adding a conversion routine.
if (dim < 3)
coord_ = v;
else
{
for (unsigned i = dim - 2; i < dim; ++i)
coord_[i] = round(v[j++]);
for (unsigned i = 2; i < dim; ++i, ++j)
coord_[i-j] = round(v[j]);
}
}
template <typename G, typename C>
......@@ -364,10 +370,16 @@ namespace mln
point<G,C>::point(const algebra::vec<dim,float>& v)
{
unsigned j = 0;
for (unsigned i = dim - 2; i < dim; ++i)
coord_[i] = round(v[j++]);
for (unsigned i = 2; i < dim; ++i, ++j)
coord_[i-j] = round(v[j]);
//FIXME: to be improved while adding a conversion routine.
if (dim < 3)
coord_ = v;
else
{
for (unsigned i = dim - 2; i < dim; ++i)
coord_[i] = round(v[j++]);
for (unsigned i = 2; i < dim; ++i, ++j)
coord_[i-j] = round(v[j]);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment