Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algebraic constraints #542

Closed
baryluk opened this issue Jan 16, 2020 · 2 comments
Closed

Algebraic constraints #542

baryluk opened this issue Jan 16, 2020 · 2 comments

Comments

@baryluk
Copy link

baryluk commented Jan 16, 2020

This is a feature request.

I would like to be able to add linear and non-linear constraints. Either as a side note on the sketch, with a symbolic names referencing dimensions, or for some constraints of the form: 'B = something_without_B' directly in the constrain line segment/distance/angle/radius.

constraints1

Ability to add implicit constraints between dimensions (ones which can't be inverted algebraically) would also be really cool:

constraints-implicit

Right now some of these types of constraints are already possible, but require a lot of auxilary construction lines and understanding a lot about geometry. Some are super tedious. B=3*A can be done relatively easy. But doing B=3.1*A will be supper annoying for example, despite the solver being able to handle algebraic constraints under the hood.

The added benefit of explicit and implicit algebraic constraints is that beyond easier reading of the sketch for documentation, it also reduces number of variables and points / lines in the sketch, which should lead to a better performance. The supported algebraic operations in the sketch should be double differntiable, which should make things easier.

Custom functions (macros), might be an extended feature, for the future. Example: f(A, B, C) := A*A + B*B - C*C + A*B/C, then use it as f(K, L, M/2) = f(X, Y, f(Z, 2.0, K)) + 3.0 for example, or in many other constraints. That might be somehow useful, but is only a syntactic sugar for manually typing things.

I don't know if there is any CAD out there that allows doing things exactly like this. But it would make solvespace extremely powerful :D

Obviously if constraints are really hard numerically, or oscillating / non-smooth, solvespace is free to give up and blame the user :D No need to be perfect or handle all possible things, as that is simply not possible in non-linear solving and optimization.

Similarly in the initial implementation, there is no need to check for dimensional units I think. I.e. user is free to pass linear dimension to the trigonometric function, or construct constraints with mismatched units, like log(A) + A*B = C, where all A, B, C are in normal linear units (mm for example). It can be detected statically by the program, but is only an extra bonus for the future.

The same could be done for inequality constraints, either on a single variable or on the expression. They could be put in the sketch for easy view and reference.

@whitequark
Copy link
Contributor

Duplicate of #77, #81, etc.

@baryluk
Copy link
Author

baryluk commented Jan 16, 2020

@whitequark Sorry for the duplicate and thanks for pointing me to the existing bugs. I did a search before posting, but I didn't see these bugs.

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants