Rduce int to float conversions
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1297 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -144,13 +144,13 @@ Tvv3<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
|
|||||||
|
|
||||||
Base::mesh_.split(_fh, vh);
|
Base::mesh_.split(_fh, vh);
|
||||||
|
|
||||||
int valence = 0;
|
typename M::Scalar valence(0.0);
|
||||||
|
|
||||||
// calculate display position for new vertex
|
// calculate display position for new vertex
|
||||||
for (vv_it = Base::mesh_.vv_iter(vh); vv_it.is_valid(); ++vv_it)
|
for (vv_it = Base::mesh_.vv_iter(vh); vv_it.is_valid(); ++vv_it)
|
||||||
{
|
{
|
||||||
position += Base::mesh_.point(*vv_it);
|
position += Base::mesh_.point(*vv_it);
|
||||||
++valence;
|
valence += 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
position /= valence;
|
position /= valence;
|
||||||
@@ -849,11 +849,11 @@ void VF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
typename M::Scalar valence(0.0);
|
||||||
|
|
||||||
for (fv_it = Base::mesh_.fv_iter(_fh); fv_it.is_valid(); ++fv_it) {
|
for (fv_it = Base::mesh_.fv_iter(_fh); fv_it.is_valid(); ++fv_it) {
|
||||||
|
|
||||||
++valence;
|
valence += 1.0;
|
||||||
position += Base::mesh_.data(*fv_it).position(_target_state - 1);
|
position += Base::mesh_.data(*fv_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -920,11 +920,11 @@ void FF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state) {
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
typename M::Scalar valence(0.0);
|
||||||
|
|
||||||
for (ff_it = Base::mesh_.ff_iter(_fh); ff_it.is_valid(); ++ff_it) {
|
for (ff_it = Base::mesh_.ff_iter(_fh); ff_it.is_valid(); ++ff_it) {
|
||||||
|
|
||||||
++valence;
|
valence += 1.0;
|
||||||
|
|
||||||
position += Base::mesh_.data(*ff_it).position(_target_state - 1);
|
position += Base::mesh_.data(*ff_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
@@ -979,11 +979,11 @@ void FFc<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
typename M::Scalar valence(0.0);
|
||||||
|
|
||||||
for (ff_it = Base::mesh_.ff_iter(_fh); ff_it.is_valid(); ++ff_it)
|
for (ff_it = Base::mesh_.ff_iter(_fh); ff_it.is_valid(); ++ff_it)
|
||||||
{
|
{
|
||||||
++valence;
|
valence += 1.0;
|
||||||
position += Base::mesh_.data(*ff_it).position(_target_state - 1);
|
position += Base::mesh_.data(*ff_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1049,11 +1049,11 @@ void FV<M>::raise(typename M::VertexHandle& _vh, state_t _target_state)
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
typename M::Scalar valence(0.0);
|
||||||
|
|
||||||
for (vf_it = Base::mesh_.vf_iter(_vh); vf_it.is_valid(); ++vf_it) {
|
for (vf_it = Base::mesh_.vf_iter(_vh); vf_it.is_valid(); ++vf_it) {
|
||||||
|
|
||||||
++valence;
|
valence += 1.0;
|
||||||
position += Base::mesh_.data(*vf_it).position(_target_state - 1);
|
position += Base::mesh_.data(*vf_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1292,12 +1292,11 @@ void VV<M>::raise(typename M::VertexHandle& _vh, state_t _target_state)
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
typename M::Scalar valence(0.0);
|
||||||
|
|
||||||
for (vv_it = Base::mesh_.vv_iter(_vh); vv_it.is_valid(); ++vv_it) {
|
for (vv_it = Base::mesh_.vv_iter(_vh); vv_it.is_valid(); ++vv_it) {
|
||||||
|
|
||||||
++valence;
|
valence += 1.0;
|
||||||
|
|
||||||
position += Base::mesh_.data(*vv_it).position(_target_state - 1);
|
position += Base::mesh_.data(*vv_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1362,12 +1361,12 @@ void VVc<M>::raise(typename M::VertexHandle& _vh, state_t _target_state)
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
typename M::Scalar valence(0.0);
|
||||||
typename M::Scalar c;
|
typename M::Scalar c;
|
||||||
|
|
||||||
for (vv_it = Base::mesh_.vv_iter(_vh); vv_it.is_valid(); ++vv_it)
|
for (vv_it = Base::mesh_.vv_iter(_vh); vv_it.is_valid(); ++vv_it)
|
||||||
{
|
{
|
||||||
++valence;
|
valence += 1.0;
|
||||||
position += Base::mesh_.data(*vv_it).position(_target_state - 1);
|
position += Base::mesh_.data(*vv_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1419,9 +1418,8 @@ void VE<M>::raise(typename M::EdgeHandle& _eh, state_t _target_state)
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
const typename M::Scalar valence(2.0);
|
||||||
|
|
||||||
valence = 2;
|
|
||||||
position += MOBJ(Base::mesh_.TVH(hh1)).position(_target_state - 1);
|
position += MOBJ(Base::mesh_.TVH(hh1)).position(_target_state - 1);
|
||||||
position += MOBJ(Base::mesh_.TVH(hh2)).position(_target_state - 1);
|
position += MOBJ(Base::mesh_.TVH(hh2)).position(_target_state - 1);
|
||||||
|
|
||||||
@@ -1479,26 +1477,25 @@ void VdE<M>::raise(typename M::EdgeHandle& _eh, state_t _target_state)
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
typename M::Scalar valence(2.0);
|
||||||
|
|
||||||
valence = 2;
|
|
||||||
position += MOBJ(Base::mesh_.TVH(hh1)).position(_target_state - 1);
|
position += MOBJ(Base::mesh_.TVH(hh1)).position(_target_state - 1);
|
||||||
position += MOBJ(Base::mesh_.TVH(hh2)).position(_target_state - 1);
|
position += MOBJ(Base::mesh_.TVH(hh2)).position(_target_state - 1);
|
||||||
|
|
||||||
if (fh1.is_valid()) {
|
if (fh1.is_valid()) {
|
||||||
|
|
||||||
position += MOBJ(Base::mesh_.TVH(Base::mesh_.NHEH(hh1))).position(_target_state - 1);
|
position += MOBJ(Base::mesh_.TVH(Base::mesh_.NHEH(hh1))).position(_target_state - 1);
|
||||||
++valence;
|
valence += 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fh2.is_valid()) {
|
if (fh2.is_valid()) {
|
||||||
|
|
||||||
position += MOBJ(Base::mesh_.TVH(Base::mesh_.NHEH(hh2))).position(_target_state - 1);
|
position += MOBJ(Base::mesh_.TVH(Base::mesh_.NHEH(hh2))).position(_target_state - 1);
|
||||||
++valence;
|
valence += 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Base::number() == Base::subdiv_rule()->Base::number() + 1)
|
if (Base::number() == Base::subdiv_rule()->Base::number() + 1)
|
||||||
valence = 4;
|
valence = 4.0;
|
||||||
|
|
||||||
position /= valence;
|
position /= valence;
|
||||||
|
|
||||||
@@ -1565,13 +1562,12 @@ VdEc<M>::raise(typename M::EdgeHandle& _eh, state_t _target_state)
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
const typename M::Scalar valence(4.0);
|
||||||
typename M::Scalar c;
|
typename M::Scalar c;
|
||||||
|
|
||||||
// choose coefficient c
|
// choose coefficient c
|
||||||
c = Base::coeff();
|
c = Base::coeff();
|
||||||
|
|
||||||
valence = 4;
|
|
||||||
position += MOBJ(Base::mesh_.TVH(hh1)).position(_target_state - 1) * c;
|
position += MOBJ(Base::mesh_.TVH(hh1)).position(_target_state - 1) * c;
|
||||||
position += MOBJ(Base::mesh_.TVH(hh2)).position(_target_state - 1) * c;
|
position += MOBJ(Base::mesh_.TVH(hh2)).position(_target_state - 1) * c;
|
||||||
position += MOBJ(Base::mesh_.TVH(Base::mesh_.NHEH(hh1))).position(_target_state - 1) * (0.5 - c);
|
position += MOBJ(Base::mesh_.TVH(Base::mesh_.NHEH(hh1))).position(_target_state - 1) * (0.5 - c);
|
||||||
@@ -1632,13 +1628,13 @@ void EV<M>::raise(typename M::VertexHandle& _vh, state_t _target_state)
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
typename M::Scalar valence(0.0);
|
||||||
|
|
||||||
for (ve_it = Base::mesh_.ve_iter(_vh); ve_it.is_valid(); ++ve_it) {
|
for (ve_it = Base::mesh_.ve_iter(_vh); ve_it.is_valid(); ++ve_it) {
|
||||||
|
|
||||||
if (Base::mesh_.data(*ve_it).final()) {
|
if (Base::mesh_.data(*ve_it).final()) {
|
||||||
|
|
||||||
++valence;
|
valence += 1.0;
|
||||||
|
|
||||||
position += Base::mesh_.data(*ve_it).position(_target_state - 1);
|
position += Base::mesh_.data(*ve_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
@@ -1829,19 +1825,19 @@ EF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state) {
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(0);
|
typename M::Scalar valence(0.0);
|
||||||
|
|
||||||
for (fe_it = Base::mesh_.fe_iter(_fh); fe_it.is_valid(); ++fe_it) {
|
for (fe_it = Base::mesh_.fe_iter(_fh); fe_it.is_valid(); ++fe_it) {
|
||||||
|
|
||||||
if (Base::mesh_.data(*fe_it).final()) {
|
if (Base::mesh_.data(*fe_it).final()) {
|
||||||
|
|
||||||
++valence;
|
valence += 1.0;
|
||||||
|
|
||||||
position += Base::mesh_.data(*fe_it).position(_target_state - 1);
|
position += Base::mesh_.data(*fe_it).position(_target_state - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (valence == 3);
|
assert (valence == 3.0);
|
||||||
|
|
||||||
position /= valence;
|
position /= valence;
|
||||||
|
|
||||||
@@ -1882,7 +1878,7 @@ FE<M>::raise(typename M::EdgeHandle& _eh, state_t _target_state) {
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(2);
|
const typename M::Scalar valence(2.0);
|
||||||
|
|
||||||
position += MOBJ(Base::mesh_.FH(Base::mesh_.HEH(_eh, 0))).position(_target_state - 1);
|
position += MOBJ(Base::mesh_.FH(Base::mesh_.HEH(_eh, 0))).position(_target_state - 1);
|
||||||
|
|
||||||
@@ -1938,7 +1934,7 @@ EdE<M>::raise(typename M::EdgeHandle& _eh, state_t _target_state) {
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(4);
|
const typename M::Scalar valence(4.0);
|
||||||
|
|
||||||
position += MOBJ(Base::mesh_.EH(Base::mesh_.NHEH(hh1))).position(_target_state - 1);
|
position += MOBJ(Base::mesh_.EH(Base::mesh_.NHEH(hh1))).position(_target_state - 1);
|
||||||
position += MOBJ(Base::mesh_.EH(Base::mesh_.PHEH(hh1))).position(_target_state - 1);
|
position += MOBJ(Base::mesh_.EH(Base::mesh_.PHEH(hh1))).position(_target_state - 1);
|
||||||
@@ -1995,7 +1991,7 @@ EdEc<M>::raise(typename M::EdgeHandle& _eh, state_t _target_state)
|
|||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
typename M::Point position(0.0, 0.0, 0.0);
|
typename M::Point position(0.0, 0.0, 0.0);
|
||||||
int valence(4);
|
const typename M::Scalar valence(4.0);
|
||||||
typename M::Scalar c;
|
typename M::Scalar c;
|
||||||
|
|
||||||
position += MOBJ(Base::mesh_.EH(Base::mesh_.NHEH(hh1))).position(_target_state - 1);
|
position += MOBJ(Base::mesh_.EH(Base::mesh_.NHEH(hh1))).position(_target_state - 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user