Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/domains/interval/codac2_Interval_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ namespace codac2

inline Interval operator""_i(long double x)
{
return Interval(x);
return Interval(static_cast<double>(x));
}

inline double prev_float(double x)
Expand Down
9 changes: 6 additions & 3 deletions src/core/functions/analytic/codac2_analytic_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ namespace codac2
if constexpr(std::is_same_v<T,ScalarType>)
return {1,1};

if constexpr(std::is_same_v<T,VectorType>)
else if constexpr(std::is_same_v<T,VectorType>)
return {_x.size(),1};

if constexpr(std::is_same_v<T,MatrixType>)
else if constexpr(std::is_same_v<T,MatrixType>)
return {_x.rows(),_x.cols()};

assert_release_constexpr(false && "unknow output shape for constant");
// In an else branch, discarded along with it for the types above:
// after their return, Visual C++ reported it as unreachable (C4702)
else
assert_release_constexpr(false && "unknow output shape for constant");
}

void replace_arg([[maybe_unused]] const ExprID& old_arg_id, [[maybe_unused]] const std::shared_ptr<ExprBase>& new_expr)
Expand Down
2 changes: 1 addition & 1 deletion src/core/operators/codac2_pow.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,6 @@ namespace codac2
{
assert_release(x2.is_degenerated() && "PowOp::bwd(y,x1,x2) (with x1 and x2 intervals) not implemented yet with Gaol");
assert_release(x2 == (int)(x2.mid()) && "PowOp::bwd(y,x1,x2) (x2 not integer) not implemented yet with Gaol");
PowOp::bwd(y, x1, x2.mid());
PowOp::bwd(y, x1, (int)(x2.mid()));
}
}
4 changes: 2 additions & 2 deletions src/graphics/3rd/vibes/vibes.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,10 @@ namespace vibes {
/// The color used for transparency is throw the pen color
VIBES_FUNC_COLOR_PARAM_5(drawRaster, const std::string&, rasterFilename,
const double &,ulb, const double &, yub,
const double &,width, const double &, height);
const double &,width, const double &, height)
VIBES_FUNC_COLOR_PARAM_6(drawRaster, const std::string&, rasterFilename,
const double &,ulb, const double &, yub,
const double &,width, const double &, height, const double &, rot);
const double &,width, const double &, height, const double &, rot)

/// Draw a Cake at position (cx,cy)
VIBES_FUNC_COLOR_PARAM_4(drawCake,const double &,cx, const double &,cy, const double &,rot, const double &,length)
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/figures/codac2_Figure2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ void Figure2D::draw_tube(const SlicedTube<IntervalVector>& x, const StyleGradien
{
draw_tube_common(*this, x, max_nb_slices_to_display,
[&style](const Interval& tube_t0tf, std::list<TSlice>::reverse_iterator it) {
auto c = style.cmap.color((it->mid()-tube_t0tf.lb())/tube_t0tf.diam());
auto c = style.cmap.color(static_cast<float>((it->mid()-tube_t0tf.lb())/tube_t0tf.diam()));
return StyleProperties({c,c}, style.layer, style.line_style, "w:"+to_string(style.line_width), "z:"+to_string(style.z_value));
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/graphics/figures/codac2_Figure3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ namespace codac2
* \param style Style (color)
*/
void draw_plane(const Vector &c, const Matrix &A, bool yaw_is_up=true,
const StyleProperties& style = { Color::dark_gray(0.8) });
const StyleProperties& style = { Color::dark_gray(0.8f) });


// Pavings
Expand All @@ -228,7 +228,7 @@ namespace codac2
* \param in_style Style of the inside of the paving
*/
void draw_paving(const PavingInOut& p,
const StyleProperties& bound_style = { Color::yellow(0.3), "paving_bound" },
const StyleProperties& bound_style = { Color::yellow(0.3f), "paving_bound" },
const StyleProperties& in_style = { Color::green(0.5) , "paving_in" });

/**
Expand Down
22 changes: 11 additions & 11 deletions src/graphics/styles/codac2_Color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ Color Color::rgb() const
float r = 0., g = 0., b = 0.;

// Normalisation des valeurs
float h = (*this)[0] / 360.; // Hue normalisée (0 à 1)
float s = (*this)[1] / 100.; // Saturation normalisée (0 à 1)
float v = (*this)[2] / 100.; // Value normalisée (0 à 1)
float h = (*this)[0] / 360.f; // Hue normalisée (0 à 1)
float s = (*this)[1] / 100.f; // Saturation normalisée (0 à 1)
float v = (*this)[2] / 100.f; // Value normalisée (0 à 1)

int i = static_cast<int>(h * 6);
float f = (h * 6) - i;
Expand All @@ -93,7 +93,7 @@ Color Color::rgb() const
g *= 255.;
b *= 255.;

return Color({r, g, b,std::min<float>(255.,((*this)[3]*2.55))},Model::RGB);
return Color({r, g, b,std::min<float>(255.f,((*this)[3]*2.55f))},Model::RGB);
}
}

Expand All @@ -103,21 +103,21 @@ Color Color::hsv() const
return *this;
else
{
float r = (*this)[0]/255.;
float g = (*this)[1]/255.;
float b = (*this)[2]/255.;
float r = (*this)[0]/255.f;
float g = (*this)[1]/255.f;
float b = (*this)[2]/255.f;
float c_max = std::max({r, g, b});
float c_min = std::min({r, g, b});
float delta = c_max - c_min;

float h = 0.0;
if (delta != 0) {
if (c_max == r) {
h = fmod((g - b) / delta, 6.0);
h = std::fmod((g - b) / delta, 6.0f);
} else if (c_max == g) {
h = (b - r) / delta + 2.0;
h = (b - r) / delta + 2.0f;
} else if (c_max == b) {
h = (r - g) / delta + 4.0;
h = (r - g) / delta + 4.0f;
}
h /= 6.0;
if (h < 0) {
Expand All @@ -133,7 +133,7 @@ Color Color::hsv() const
s*=100.;
v*=100.;

return Color({h, s, v,std::min<float>(100.,((*this)[3]/2.55))},Model::HSV);
return Color({h, s, v,std::min<float>(100.f,((*this)[3]/2.55f))},Model::HSV);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/graphics/styles/codac2_ColorMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Color ColorMap::color(float r) const
assert(Interval(0.,1.).contains(r));

Interval map_domain = Interval(this->begin()->first,prev(this->end())->first);
float real_index = map_domain.lb() + r*map_domain.diam();
float real_index = static_cast<float>(map_domain.lb() + r*map_domain.diam());

if(this->find(real_index) == this->end()) // color interpolation
{
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/styles/codac2_ColorMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace codac2
int i = 0;
for(int h = 300 ; h > 0 ; h-=10)
{
cmap[i]=Color({(float)h,100.,100.,100.f*alpha},Model::HSV);
cmap[(float)i]=Color({(float)h,100.,100.,100.f*alpha},Model::HSV);
i++;
}
return cmap;
Expand Down
Loading