Commit 22554e00 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'warnings_ok' into 'master'

Warnings ok

See merge request !105
parents bb75d702 8e81de40
Pipeline #3555 passed with stage
in 45 minutes and 50 seconds
......@@ -91,7 +91,7 @@ void ModEdgeLengthT<MeshT>::set_error_tolerance_factor(double _factor) {
// the smaller the factor, the smaller edge_length_ gets
// thus creating a stricter constraint
// division by error_tolerance_factor_ is for normalization
float edge_length = edge_length_ * _factor / this->error_tolerance_factor_;
typename Mesh::Scalar edge_length = edge_length_ * static_cast<typename Mesh::Scalar>(_factor / this->error_tolerance_factor_);
set_edge_length(edge_length);
this->error_tolerance_factor_ = _factor;
}
......
......@@ -94,7 +94,7 @@ class ModEdgeLengthT: public ModBaseT<MeshT> {
}
/// set edge_length
void set_edge_length(float _f) {
void set_edge_length(typename Mesh::Scalar _f) {
edge_length_ = _f;
sqr_edge_length_ = _f * _f;
}
......
......@@ -89,7 +89,7 @@ distPointTriangleSquared( const Point& _p,
if (d < FLT_MIN && d > -FLT_MIN) {
return -1.0;
}
const double invD = 1.0 / d;
const Scalar invD = static_cast<Scalar>(1.0) / d;
// these are not needed for every point, should still perform
// better with many points against one triangle
......
......@@ -229,17 +229,17 @@ Tvv3<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
MOBJ(vh1).set_state(_target_state);
MOBJ(vh1).set_not_final();
MOBJ(vh0).set_position(_target_state, MOBJ(vh0).position(_target_state - 1) * 3.0);
MOBJ(vh0).set_position(_target_state, MOBJ(vh0).position(_target_state - 1) * static_cast<typename M::Point::value_type>(3.0));
MOBJ(vh0).set_state(_target_state);
MOBJ(vh0).set_not_final();
// set display position and attributes for old vertices
Base::mesh_.set_point(vh2, (Base::mesh_.point(vh3) * 2.0 + Base::mesh_.point(vh0)) / 3.0);
Base::mesh_.set_point(vh2, (Base::mesh_.point(vh3) * static_cast<typename M::Point::value_type>(2.0) + Base::mesh_.point(vh0)) / static_cast<typename M::Point::value_type>(3.0) );
MOBJ(vh2).set_position(_target_state, zero_point);
MOBJ(vh2).set_state(_target_state);
MOBJ(vh2).set_not_final();
MOBJ(vh3).set_position(_target_state, MOBJ(vh3).position(_target_state - 1) * 3.0);
MOBJ(vh3).set_position(_target_state, MOBJ(vh3).position(_target_state - 1) * static_cast<typename M::Point::value_type>(3.0) );
MOBJ(vh3).set_state(_target_state);
MOBJ(vh3).set_not_final();
......@@ -326,7 +326,7 @@ void Tvv3<M>::raise(typename M::VertexHandle& _vh, state_t _target_state) {
this->update(_vh, _target_state);
// multiply old position by 3
MOBJ(_vh).set_position(_target_state, MOBJ(_vh).position(_target_state - 1) * 3.0);
MOBJ(_vh).set_position(_target_state, MOBJ(_vh).position(_target_state - 1) * static_cast<typename M::Point::value_type>(3.0) );
MOBJ(_vh).inc_state();
......@@ -650,7 +650,7 @@ Tvv4<M>::raise(typename M::VertexHandle& _vh, state_t _target_state)
this->update(_vh, _target_state);
// multiply old position by 4
MOBJ(_vh).set_position(_target_state, MOBJ(_vh).position(_target_state - 1) * 4.0);
MOBJ(_vh).set_position(_target_state, MOBJ(_vh).position(_target_state - 1) * static_cast<typename M::Point::value_type>(4.0));
MOBJ(_vh).inc_state();
}
......@@ -2004,7 +2004,7 @@ EdEc<M>::raise(typename M::EdgeHandle& _eh, state_t _target_state)
// choose coefficient c
c = Base::coeff();
position *= (1.0 - c);
position *= ( static_cast<typename M::Scalar>(1.0) - c);
position += MOBJ(_eh).position(_target_state - 1) * c;
......
......@@ -346,7 +346,7 @@ CatmullClarkT<MeshType,RealType>::update_vertex( MeshType& _m, const VertexHandl
for ( ve_itr = _m.ve_iter( _vh); ve_itr.is_valid(); ++ve_itr)
if ( _m.is_boundary( *ve_itr))
pos += _m.property( ep_pos_, *ve_itr);
pos /= 3.0;
pos /= static_cast<typename MeshType::Point::value_type>(3.0);
}
else // inner vertex
{
......
......@@ -116,7 +116,7 @@ void CompositeT<MeshType,RealType>::Tvv3()
// set new positions for vertices
v_it = mesh_.vertices_begin();
for (j = 0; j < n_vertices; ++j) {
mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * 3.0);
mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * static_cast<typename MeshType::Point::value_type>(3.0) );
++v_it;
}
......@@ -180,7 +180,7 @@ void CompositeT<MeshType,RealType>::Tvv4()
// set new positions for vertices
v_it = mesh_.vertices_begin();
for (j = 0; j < n_vertices; ++j) {
mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * 4.0);
mesh_.data(*v_it).set_position(mesh_.data(*v_it).position() * static_cast<typename MeshType::Point::value_type>(4.0) );
++v_it;
}
......@@ -581,7 +581,7 @@ void CompositeT<MeshType,RealType>::FVc(Coeff& _coeff)
++valence;
}
c = _coeff(valence);
c = static_cast<real_t>(_coeff(valence));
for (voh_it = mesh_.voh_iter(*v_it); voh_it.is_valid(); ++voh_it) {
......@@ -589,7 +589,7 @@ void CompositeT<MeshType,RealType>::FVc(Coeff& _coeff)
if (mesh_.face_handle(mesh_.opposite_halfedge_handle(mesh_.next_halfedge_handle(*voh_it))).is_valid()) {
cog += mesh_.data(mesh_.face_handle(*voh_it)).position() * c;
cog += mesh_.data(mesh_.face_handle(mesh_.opposite_halfedge_handle(mesh_.next_halfedge_handle(*voh_it)))).position() * (1.0 - c);
cog += mesh_.data(mesh_.face_handle(mesh_.opposite_halfedge_handle(mesh_.next_halfedge_handle(*voh_it)))).position() * (static_cast<typename MeshType::Point::value_type>(1.0) - c);
} else {
cog += mesh_.data(mesh_.face_handle(*voh_it)).position();
}
......@@ -1250,7 +1250,7 @@ CompositeT<MeshType,RealType>::split_edge(HalfedgeHandle _heh)
vh2(mesh_.from_vertex_handle(_heh));
// Calculate and Insert Midpoint of Edge
vh = mesh_.add_vertex((mesh_.point(vh2) + mesh_.point(vh1)) / 2.0);
vh = mesh_.add_vertex((mesh_.point(vh2) + mesh_.point(vh1)) / static_cast<typename MeshType::Point::value_type>(2.0) );
// Re-Set Handles
heh2 = mesh_.opposite_halfedge_handle(_heh);
......
......@@ -326,7 +326,7 @@ private: // topological modifiers
typename mesh_t::VertexHandle vh1(_m.to_vertex_handle(heh));
typename mesh_t::Point midP(_m.point(_m.to_vertex_handle(heh)));
midP += _m.point(_m.to_vertex_handle(opp_heh));
midP *= 0.5;
midP *= static_cast<typename mesh_t::Point::value_type>(0.5);
// new vertex
vh = _m.new_vertex( midP );
......@@ -394,7 +394,7 @@ private: // geometry helper
// boundary edge: just average vertex positions
if (_m.is_boundary(_eh) )
{
pos *= 0.5;
pos *= static_cast<typename MeshType::Point::value_type>(0.5);
}
else // inner edge: add neighbouring Vertices to sum
{
......
......@@ -150,14 +150,14 @@ public:
{
weights[K].resize(K+1);
// s(j) = ( 1/4 + cos(2*pi*j/K) + 1/2 * cos(4*pi*j/K) )/K
real_t invK = 1.0/real_t(K);
double invK = 1.0/static_cast<double>(K);
real_t sum = 0;
for(unsigned int j=0; j<K; ++j)
{
weights[K][j] = (0.25 + cos(2.0*M_PI*j*invK) + 0.5*cos(4.0*M_PI*j*invK))*invK;
weights[K][j] = static_cast<real_t>((0.25 + cos(2.0*M_PI*static_cast<double>(j)*invK) + 0.5*cos(4.0*M_PI*static_cast<double>(j)*invK))*invK);
sum += weights[K][j];
}
weights[K][K] = (real_t)1.0 - sum;
weights[K][K] = static_cast<real_t>(1.0) - sum;
}
}
......@@ -390,7 +390,7 @@ private: // geometry helper
{
pos = _m.point(a_0);
pos += _m.point(a_1);
pos *= 9.0/16;
pos *= static_cast<typename mesh_t::Point::value_type>(9.0/16.0);
typename mesh_t::Point tpos;
if(_m.is_boundary(heh))
{
......@@ -403,7 +403,7 @@ private: // geometry helper
tpos = _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(opp_heh)));
tpos += _m.point(_m.to_vertex_handle(_m.opposite_halfedge_handle(_m.prev_halfedge_handle(opp_heh))));
}
tpos *= -1.0/16;
tpos *= static_cast<typename mesh_t::Point::value_type>(-1.0/16.0);
pos += tpos;
}
else
......@@ -506,7 +506,7 @@ private: // geometry helper
}
else //at least one endpoint is [irregular and not in boundary]
{
double normFactor = 0.0;
typename mesh_t::Point::value_type normFactor = static_cast<typename mesh_t::Point::value_type>(0.0);
if(valence_a_0!=6 && !_m.is_boundary(a_0))
{
......
......@@ -158,11 +158,13 @@ public:
for(unsigned int K=5; K<_max_valence; ++K)
{
weights_[K].resize(K+1);
real_t aH = 2.0*cos(M_PI/K)/3.0;
weights_[K][K] = 1.0 - aH*aH;
double aH = 2.0*cos(M_PI/static_cast<double>(K))/3.0;
weights_[K][K] = static_cast<real_t>(1.0 - aH*aH);
for(unsigned int i=0; i<K; ++i)
{
weights_[K][i] = (aH*aH + 2.0*aH*cos(2.0*i*M_PI/K + M_PI/K) + 2.0*aH*aH*cos(4.0*i*M_PI/K + 2.0*M_PI/K))/K;
weights_[K][i] = static_cast<real_t>((aH*aH + 2.0*aH*cos(2.0*static_cast<double>(i)*M_PI/static_cast<double>(K) + M_PI/static_cast<double>(K)) +
2.0*aH*aH*cos(4.0*static_cast<double>(i)*M_PI/static_cast<double>(K) + 2.0*M_PI/static_cast<double>(K)))/static_cast<double>(K));
}
}
......
......@@ -328,7 +328,7 @@ TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, vf_iter_bounda
* \ /
* 5
*/
size_t current_halfedge_handles[9] = {
int current_halfedge_handles[9] = {
0,2,12,4,6,8,16,10,14
};
std::vector<Mesh::FaceHandle> fh0;
......
......@@ -164,7 +164,7 @@ TEST_F(OpenMeshOthers, CalcDihedralAngre ) {
EXPECT_EQ( 0.0 , mesh_.calc_dihedral_angle(eh) ) << "Wrong Dihedral angle!" << std::endl;
// Modify point
Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) * 0.5;
Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) * static_cast<Mesh::Point::value_type>(0.5);
mesh_.point(vhandle[2]) = tmp;
double difference = fabs( 1.36944 - mesh_.calc_dihedral_angle(eh) );
......
Markdown is supported
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