From 9cc2ff7944e26be52f53786da2f129cb804b2646 Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Thu, 18 Dec 2014 22:36:51 +0300 Subject: [PATCH] Sketcher Constraints: small code refactor Unifying first checks in grad(). --- src/Mod/Sketcher/App/freegcs/Constraints.cpp | 48 ++++++++------------ src/Mod/Sketcher/App/freegcs/Constraints.h | 1 + 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/src/Mod/Sketcher/App/freegcs/Constraints.cpp b/src/Mod/Sketcher/App/freegcs/Constraints.cpp index 6e6368f0c..00f0e3efb 100644 --- a/src/Mod/Sketcher/App/freegcs/Constraints.cpp +++ b/src/Mod/Sketcher/App/freegcs/Constraints.cpp @@ -84,6 +84,18 @@ double Constraint::maxStep(MAP_pD_D &dir, double lim) return lim; } +int Constraint::findParamInPvec(double *param) +{ + int ret = -1; + for( int i=0 ; i TODO: vectorized grad version virtual double maxStep(MAP_pD_D &dir, double lim=1.); + int findParamInPvec(double* param);//finds first occurence of param in pvec. This is useful to test if a constraint depends on the parameter (it may not actually depend on it, e.g. angle-via-point doesn't depend on ellipse's b (radmin), but b will be included within the constraint anyway. Returns -1 if not found. }; // Equal