[Sketcher][planegcs] Handle type issues with int and size_t

... and `unsigned int`

Suggestions thanks to @abdullahtahiriyo
This commit is contained in:
Ajinkya Dahale
2022-11-06 23:06:07 +05:30
committed by Chris Hennes
parent a609bce527
commit dd02c7a6f3
4 changed files with 7 additions and 7 deletions

View File

@@ -812,7 +812,7 @@ int System::addConstraintTangentCircumf(Point &p1, Point &p2, double *rad1, doub
return addConstraint(constr);
}
int System::addConstraintTangentAtBSplineKnot(BSpline &b, Line &l, size_t knotindex, int tagId, bool driving)
int System::addConstraintTangentAtBSplineKnot(BSpline &b, Line &l, unsigned int knotindex, int tagId, bool driving)
{
Constraint *constr = new ConstraintSlopeAtBSplineKnot(b, l, knotindex);
constr->setTag(tagId);

View File

@@ -257,7 +257,7 @@ namespace GCS
int tagId=0, bool driving = true);
int addConstraintTangentCircumf(Point &p1, Point &p2, double *rd1, double *rd2,
bool internal=false, int tagId=0, bool driving = true);
int addConstraintTangentAtBSplineKnot(BSpline &b, Line &l, size_t knotindex,
int addConstraintTangentAtBSplineKnot(BSpline &b, Line &l, unsigned int knotindex,
int tagId=0, bool driving = true);
// derived constraints

View File

@@ -712,7 +712,7 @@ BSpline* BSpline::Copy()
return crv;
}
double BSpline::getLinCombFactor(double x, size_t k, size_t i, size_t p)
double BSpline::getLinCombFactor(double x, size_t k, size_t i, unsigned int p)
{
// Adapted to C++ from the python implementation in the Wikipedia page for de Boor algorithm
// https://en.wikipedia.org/wiki/De_Boor%27s_algorithm.
@@ -734,7 +734,7 @@ double BSpline::getLinCombFactor(double x, size_t k, size_t i, size_t p)
return 0.0;
d[idxOfPole] = 1.0;
for (size_t r = 1; static_cast<int>(r) < p + 1; ++r) {
for (size_t r = 1; r < p + 1; ++r) {
for (size_t j = p; j > r - 1; --j) {
double alpha =
(x - flattenedknots[j + k - p]) /
@@ -746,7 +746,7 @@ double BSpline::getLinCombFactor(double x, size_t k, size_t i, size_t p)
return d[p];
}
double BSpline::splineValue(double x, size_t k, size_t p, VEC_D& d, const VEC_D& flatknots)
double BSpline::splineValue(double x, size_t k, unsigned int p, VEC_D& d, const VEC_D& flatknots)
{
for (size_t r = 1; r < p + 1; ++r) {
for (size_t j = p; j > r - 1; --j) {

View File

@@ -304,7 +304,7 @@ namespace GCS
/// k is the range in `flattenedknots` that contains x
/// i is index of control point
/// p is the degree
double getLinCombFactor(double x, size_t k, size_t i, size_t p);
double getLinCombFactor(double x, size_t k, size_t i, unsigned int p);
inline double getLinCombFactor(double x, size_t k, size_t i)
{ return getLinCombFactor(x, k, i, degree); }
void setupFlattenedKnots();
@@ -314,7 +314,7 @@ namespace GCS
/// p is the degree
/// d is the vector of (relevant) poles (this will be changed)
/// flatknots is the vector of knots
static double splineValue(double x, size_t k, size_t p, VEC_D& d, const VEC_D& flatknots);
static double splineValue(double x, size_t k, unsigned int p, VEC_D& d, const VEC_D& flatknots);
};
} //namespace GCS