Commit Graph

207 Commits

Author SHA1 Message Date
Ajinkya Dahale
fddf704a4d Sketcher: Use range-based for in Sketch.cpp 2025-05-19 20:24:17 +02:00
bofdahof
ba2c2ca5ad Console: rename PascalCase named methods to camelCase 2025-05-06 17:50:21 +02:00
Benjamin Nauck
3279a1dd8f Sketcher: Use std::numeric_limits and std::numbers instead of defines 2025-03-29 13:32:39 +01:00
bofdahof
fb71aa3292 Sketcher: apply std::ranges 2025-03-16 17:18:12 -05:00
PaddleStroke
17e6aa9629 Sketcher: Rename movePoint to moveGeometries. 2024-12-06 16:45:47 +01:00
PaddleStroke
95c3d4febc Sketcher: Group dragging 2024-12-04 10:58:29 +01:00
wmayer
9f44b3f9a8 Sketch: Refactor Sketch::updateGeometry() 2024-05-20 11:38:06 -05:00
Florian Foinant-Willig
ef35ec195d Sketcher : ArcLength Constraint 2024-03-25 22:32:20 +01:00
Ladislav Michl
d95b56137b Base: Implement TimeElapsed
Some instances of TimeInfo serve the sole purpose of measuring time
duration. Using system time is unfortunate as it returns wall clock,
which is not guaranteed to be monotonic. Replace such a usage with
the new TimeElapsed class based on steady clock.
2024-03-05 12:29:24 +01:00
Ajinkya Dahale
26e7b0a704 [Sketcher] Use angle-via-two-points in e2e with BSplines 2024-02-27 09:57:52 -06:00
wmayer
5eabeff94e Mod: fix several compiler warnings:
* fix -Wsometimes-uninitialized
* fix -Wunused-parameter
* fix -Wunused-variable
* fix -Winconsistent-missing-override
* fix -Wsign-compare
* fix -Wreorder-ctor
* fix -Wtautological-overlap-compare
2024-02-12 11:39:32 -06:00
Ajinkya Dahale
cf3e0c1b4a [Sketcher] Expose general tangency with B-splines to Sketcher
The following commits were squashed into this

[Sketcher] Handle some corner cases in AngleViaPoint

[Sketcher] Avoid redundant constraints with B-splines...

When involving tangent, perpendicular and angle constraints.

[Sketcher] Add pre-commit changes

[Sketcher] Do not allow 2-selection tangent with B-spline

Also...

[Sketcher] Report error when using direct tangency with B-splines

[Sketcher] Fix malformed constraint when B-spline is selected second

To clarify, this means the second curve selected. The position of the point in
selection order does not matter in angle-via-point.

[Sketcher] Fix wrong number for B-Spline tangent on redundancy

[Sketcher] Remove existing point-on-object in some redundant cases

Particularly when point constrained on a B-spline is being used for
tangent, perpendicular or angle via point with the same B-spline.

[Sketcher] Fix direction issue with B-spline tangents.

Without these changes the solver might try to "twist" the B-spline to make the
angle between curves be 0 instead of PI (which may be closer to the initial shape).
2024-02-08 20:04:28 +05:30
Abdullah Tahiri
ed14b2c845 Sketch: Distance - fix uninit pointers and scope 2023-12-17 16:01:29 +01:00
Florian Foinant-Willig
7343bf940b Sketcher: Extend distance constraint to arcs 2023-12-17 16:01:29 +01:00
Florian Foinant-Willig
838802e28d Sketcher: Arc to arc or circle distance constraint 2023-12-17 16:01:29 +01:00
Abdullah Tahiri
c34bc88d66 Sketcher: Solver - Remove outdated request for reporting 2023-12-04 16:32:23 +01:00
Chris Hennes
37a8e348c6 Merge pull request #11231 from DeflateAwning/http-cleanup
Find and replace http://freecad to https://freecad
2023-11-06 11:16:13 -06:00
DeflateAwning
1e3179e9bc Find and replace http://freecad.org to https://freecad.org
Find and replace:
http:\/\/(.{0,10})freecad
https://$1freecad
Done in all remaining files (after doing it in SVGs in the last commit)
2023-10-29 22:39:22 -06:00
Florian Foinant-Willig
c0e8fa1e75 Sketcher: modernize type checking 2023-10-23 18:09:23 +02:00
pre-commit-ci[bot]
e92ed45df9 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-09-12 13:02:35 -04:00
Florian Foinant-Willig
9681ad595b Sketcher: Point to Circle Distance Constraints (#9559) 2023-08-28 10:58:09 -05:00
Florian Foinant-Willig
f42695b0fa Sketcher: fix CircleToCircle distance constraint with external
Create c2c distance constraint with one external geometry raised a
malformed constraint error

+ clang format catch by precommit hook
2023-07-01 19:42:09 +02:00
Abdullah Tahiri
0f14065d0a Sketcher: App - Clang-format 2023-05-20 07:55:05 +02:00
Florian Foinant-Willig
d3322ead12 Sketcher : Circle to Line Distance Constraint 2023-05-02 15:41:51 +02:00
luzpaz
38a01939e0 Migrate domain name from freecadweb to freecad (#9352)
* Migrate domain name from freecadweb to freecad
* Migrate src/Mod/Material files
* Migrate Stylesheet related files
* Migrate *.svg files
* Migrate miscellaneous files
* Migrate some build files
* Migrate recently added TD AR_IRAM template files

Closes #6415
2023-04-24 15:19:20 -05:00
flachyjoe
e2a13763e9 Sketcher: Add circle to circle distance constraint 2023-03-19 14:05:35 +01:00
Ajinkya Dahale
d5793dc0e4 [Sketcher] Enable point-on-B-spline in Sketcher and GUI
Also squashes:

[Sketcher] Allow point on external B-spline
2023-01-21 21:41:27 +01:00
Ajinkya Dahale
6d59b2d28e [Sketcher] Add line tangent at knot through endpoint 2023-01-17 16:02:23 +01:00
Ajinkya Dahale
0c017a39f6 [Sketcher] Disallow tangent-at-knot for non-line in solver
This is already stopped in the GUI, but this is still possible by passing the
curve IDs through the console.
2022-12-24 18:22:16 -06:00
Ajinkya Dahale
0ab7d50639 [Sketcher] Do not use TangentViaPoint for tangent-at-knot 2022-12-24 18:22:16 -06:00
Abdullah Tahiri
b015ae3f0d [Sketcher] Separate line-tangent-at-knot from angle-at-point
The latter is intended for a specific solver constraint.

[Sketcher] Make further changes for tangent-at-knot separation

1. Remove code for tangent-at-knot from `addAngleAtPointConstraint`.
2. Use correct order of input.
3. Separate internal C0 knot vs end knots. The latter can still be constrained
but the user must use endpoints of the spline instead of knots.
2022-12-24 18:22:16 -06:00
Abdullah Tahiri
e3fe3902df Sketcher: Solver - add map for Internal Alignment geometry 2022-12-24 18:22:16 -06:00
Ajinkya Dahale
75f2a1d69a [Sketcher] Use tangent at B-spline knot constraint
Also squashes:

[Sketcher] Make tangent-at-knot with just knot and line

[Sketcher] Disallow tangent at C0 knot

If passed on to planegcs can cause segmentation fault.

[Sketcher] (Re-)Support tangent at B-spline end-knots

New code had introduced problems for non-periodic spline end-points, and
periodic spline "end-points" were not supported anyway.

(here end-points mean star/end points)
2022-12-24 18:22:16 -06:00
Abdullah Tahiri
93c26a6c63 Sketcher: Make parabola axis to be internal alignment 2022-12-21 16:01:23 +01:00
Uwe
365d968ae8 [Sketch] App P - End: remove unused headers
- also some sorting
2022-12-11 22:36:00 +01:00
Ajinkya Dahale
ba4f2bf128 [Sketcher] Constrain B-spline knots as linear combination of poles
Also squashes:

[Sketcher] Create center of gravity constraint in planegcs

[Sketcher] typo

[Sketcher] Use accurate "weights" for knots

By weights we mean the linear combination factor B_i(x) such that
spline(x) = sum(pole_i * B_i(x)) for _non-rational_ splines.

[Sketcher] Use more appropriate weights for knots

These are relevant for knots _away_ from any ends (and possibly other high
multiplicity knots).

[Sketcher] Make COG constraint weights user-definable

[Sketcher] Make `flattenedknots` for periodic B-Splines

[Sketcher] Fix incorrect setup of `flattenedknots`

Without ensuring enough space, iterators become invalid. These iterators are
needed because for periodic B-splines we need to pad flattenedknots with offset
values within flattenedknots.

Apparently there is still some iterator issues even after the reserve. Just use
fresh vectors instead.

[Sketcher] Apply knot constraints by parameter

Hopefully this will allow directly applying constraints on knots.

[Sketcher] Disable some knot updating

[Sketcher] Use center of gravity constraint on knots

[Sketcher] Fix knot COG constraint for periodic splines

[Sketcher] Add start/end point of periodic spline to solver

This removes the trouble of transferring constraints to the underlying knot.

[Sketcher] Support knot constraints on rational B-splines

[Sketcher] Remove virtual from overridden methods in planegcs

Follow 0penbrain's comments

[Sketcher][planegcs] Use `unsigned int` in signatures

Also `size_t` at places

Suggestions by @abdullahtahiriyo
2022-11-16 15:35:37 +01:00
Ajinkya Dahale
bad4406387 [Sketcher] Reformat some if-else for readability
Weren't folding right in spacemacs.
This commit can be omitted if undesired.
2022-11-16 15:35:37 +01:00
Abdullah Tahiri
4d1e1733e3 Sketcher: Solver - Improvement of popularity contest and bug fix
================================================================

Master has a problem in that internal alignment constraints are suggested to the user for removal.

This is fundamentally wrong, as an internal alignment constraint are an inherent part of the geometry. They cannot be the ones suggested for removal.

The popularity contest algorithm is an heuristic algorithm that determines which redundant/conflicting constraints should be proposed for removal.

Basically, the algorithm works on groups of redundant/conflicting constraints detected via the QR decomposition. A constraint may belong to more than one group.

The algorithm runs some heuristics, each constraint scoring a value, the one constraint from each group scoring the highest is proposed (is more popular and wins the contest).

This PR documents the algorithm, and adds a further condition, that internal alignment constraints are never proposed.

As the solver works with solver constraints as opposed to the sketcher, which works with sketcher constraints, information about whether a solver constraint originated from a
sketcher constraint that is internal alignment is necessary. So the solver constraint is extended to accomodate this piece of information.

As a bonus, it fixes a bug. Solver constraints carry information of the ID of the corresponding sketcher constraint in their tag. Knots are not currently implemented as constraints.
However, the tag index was not being update. This caused the popularity contest to provide wrong suggestions despite good detection.
2022-10-21 19:54:51 +02:00
berniev
f4ffd15864 Mod: redundant void 2 2022-08-08 10:27:50 +02:00
berniev
53ba98d636 Mod: use empty 2022-08-06 19:30:13 +02:00
Uwe
0399b3f087 [Sketch] remove superfluous nullptr checks 2022-07-18 02:51:49 +02:00
wmayer
4aecefb3cc Sketch: [skip ci] fix -Wsign-compare 2022-07-11 11:08:52 +02:00
Ajinkya Dahale
f958e1a215 [Sketcher] Do regular drag for small B-splines
Here, "small" means that the number of poles of the spline is so low that moving
any piece of the curve without changing shape would require moving all the
poles. In that case the rest of the algorithm in `initBSplinePieceMove()` only
complicates the matter.
2022-07-07 08:17:20 +02:00
Ajinkya Dahale
4db7da7314 [Sketcher] Only move one piece of B-spline when dragging 2022-07-02 07:35:30 +02:00
Abdullah Tahiri
ad6576d385 Sketcher: SolverGeometryExtension and sketch parameter information improvements
===============================================================================

* SolverGeometryExtension is extended to:
- Enable to determine whether the x or the y of a point is a dependent or independent parameter
- Extend SolverExtension to provide information on individual edge parameters
- Convenience access to DoF status

* Sketch (solver interface) is extended to store geometry parameter dependency state, for these reasons:

Geometry and Constraint solver information is generated when performing a full solve() [QR decomposition + minimization(e.g. DogLeg)].

Constraint information remains in the sketch object (not SketchObject, but sketch), which is then retrieved by SketchObject.

Geometry information is incorporated to the deep copy of Geometry that the sketch object comprises. However, this information is only
available outside the sketch object, if the Geometry property of SketchObject is assigned. This is always the situation after a successful
full solve. However, it is not the case in a successful temporary minimal diagnosis (here succesful relates to conflicting/redundant constraints and
convergence).

The lightweight solution is to keep a (shallow) copy of the SolverGeometryExtensions (shared pointer) to be retrieved by GeoId, which is what is provided.
2022-06-28 18:57:17 +02:00
andrea
c66aadeb60 removed references to OCC<7 2022-06-25 14:29:24 +02:00
Uwe
61be686687 [Sketch] remove unnecessary Boolean comparisons 2022-06-19 18:35:52 +02:00
wmayer
51186c018e Sketcher: modernize C++11
* use nullptr
2022-03-23 19:26:15 +01:00
wmayer
585bcb8708 lgtm: [skip ci] FIXME comment
Change FIXME or remove it
2022-03-20 16:51:23 +01:00
Abdullah Tahiri
bba7c89c2a Sketcher: Coverity 332695 - unlikely array indexing with negative value 2022-03-12 21:14:19 +01:00