Commit Graph

51 Commits

Author SHA1 Message Date
wmayer
08b10cd287 fix cppcoreguidelines-*
* cppcoreguidelines-init-variables
* cppcoreguidelines-c-copy-assignment-signature
* cppcoreguidelines-macro-usage
* cppcoreguidelines-non-private-member-variables-in-classes
* cppcoreguidelines-pro-type-member-init
* cppcoreguidelines-slicing
* cppcoreguidelines-special-member-functions
* cppcoreguidelines-virtual-class-destructor
2023-11-16 01:22:09 +01:00
wmayer
39337ea12e fix bugprone-*
* bugprone-throw-keyword-missing
* bugprone-unhandled-self-assignment
* bugprone-suspicious-string-compare
* bugprone-reserved-identifier
* bugprone-narrowing-conversions
* bugprone-macro-parentheses
* bugprone-implicit-widening-of-multiplication-result
* bugprone-exception-escape
* bugprone-copy-constructor-init
2023-11-16 01:22:09 +01:00
wmayer
7c00932fa0 fix readability-isolate-declarations 2023-11-16 01:22:08 +01:00
wmayer
f539138dd9 fix readability-*:
* readability-const-return-type
* readability-container-data-pointer
* readability-container-size-empty
* readability-delete-null-pointer
* readability-else-after-return
* readability-inconsistent-declaration-parameter-name
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-redundant-string-cstr
* readability-use-anyofallof
* readability-static-definition-in-anonymous-namespace
* readability-static-accessed-through-instance
* readability-simplify-boolean-expr
2023-11-16 01:22:08 +01:00
wmayer
767647a05f fix readability-avoid-const-params-in-decls 2023-11-16 01:22:08 +01:00
wmayer
e85c383bff Base: apply clang format 2023-11-13 12:01:26 -05:00
Jolbas
2d8c280528 Create rotation from any matrix
To help find a matrix components a decompose method is added to Matrix class
2023-09-28 15:25:29 -05:00
mosfet80
d453672ab8 [BASE] Removed dead code (#10330) 2023-08-28 10:41:20 -05:00
wmayer
010dca8303 Base: C++ core guidelines: init variables 2023-08-24 18:48:52 +02:00
wmayer
8f08d8c7cd Lint: fix several issues discovered by clazy 2023-08-18 08:44:49 -05:00
wmayer
2bc90e6090 Base: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
Jolbas
6c3efbdb3b Fix create Rotation from scaled matrix
Support for creation of Rotation from matrices which is a combination of non uniform scale and a rotation
Fixes according to review
Scale -1 is Uniform, Not NoScaling
Fix hasScale() when negative scale
2023-02-24 20:33:40 -06:00
wmayer
bb566c7777 Base: add overloaded method isIdentity() to Rotation and Placement that accepts a tolerance 2023-01-03 10:54:47 +01:00
marioalexis
1972dfe5a3 Base: Replace C cast 2022-09-18 11:06:51 -05:00
wmayer
d2168f51b9 Base: modernize C++: replace 'typedef' with 'using' 2022-08-29 11:42:09 +02:00
wmayer
91ea39a5c0 Base: extend Placement/Rotation API
* Add Placement::isSame() and expose to Python
* Add Placement::multRight/Placement::multLeft
* Fix PlacementPy::rotate
* Add Rotation::multRight/Rotation::multLeft
* Add a test feature FeatureTestPlacement for uni tests
* Add unit tests
2022-08-09 11:54:05 +02:00
wmayer
4d00faeceb Base: add methods to transform a Vector3f with a Rotation or Placement 2022-08-04 11:45:39 +02:00
wmayer
2e3f3bab7e Base: [skip ci] use Precision class in Rotation::makeRotationByAxes 2022-07-30 17:21:59 +02:00
wmayer
c7c43fcf4b Core: fix minor issues:
+ fix issues found by clang's clazy tool
+ fix cppcoreguidelines-pro-type-member-init
  * Make sure that all class members are initialized in the constructor
2022-06-30 16:31:16 +02:00
marioalexis
f64916dc5e Base: Set angle in Rotation::inverse function 2022-06-19 15:44:05 +02:00
wmayer
cd65de7e44 Base: fix conversion from Placement to Matrix
See also: https://forum.freecadweb.org/viewtopic.php?f=3&t=61000
2022-04-29 13:45:50 +02:00
wmayer
882e34f2ce Base: modernize C++11
* use nullptr
2022-03-23 16:57:25 +01:00
wmayer
e4435cdcba Base/App: fix warnings from code analysers:
* convert old-style-casts to explicit C++ casts where possible
* make some implicit conversions explicit
2022-03-06 23:49:30 +01:00
Uwe
f20840442f [Base] Quantity, Rotation, Stream: remove unused includes 2022-03-01 11:27:54 +01:00
wmayer
4d87039635 Base: modernize C++11
* remove redundant void-arg
* use nullptr
* replace deprecated headers
2022-01-25 20:21:30 +01:00
wmayer
b159144e13 Base: [skip ci] handle gimbal lock when computing Euler angles 2021-10-27 17:02:07 +02:00
0penBrain
e1dc69f56d [Core] Rotation : improve gimbal lock handling
Tolerance copied from OCC "gp_Quaternion.cxx"
2021-09-27 16:52:21 +02:00
0penBrain
59a4a4c361 [Core] Rotation : fix gimbal lock handling
+ fix Euler representation on GUI
2021-09-13 18:34:58 +02:00
Zheng, Lei
c1454dfbed Base: add new API Rotation::get/setEulerAngles()
Exposed to Python as new constructor parameters and
Rotation.toEulerAngles()

This function uses the code from OCCT
gp_Quaternion::Get/SetEulerAngles() to support all 24 possible
generalized euler rotation sequences. Call Rotation.toEulerAngles()
without argument to obtain all possible sequence types.
2021-05-02 17:20:45 +08:00
luz paz
d5f6c096b8 Base: Fix header uniformity, whitespace, and doxygen
[skip ci]
2020-11-22 18:12:16 +01:00
luz.paz
d36c3ebe57 Trivial code formatting for some {.cpp,.h} files 2020-04-06 12:55:27 +02:00
wmayer
1f3d2389bc start to replace old C-style casts with static_cast or reinterpret_cast, avoid implicit casts 2019-09-16 17:59:18 +02:00
wmayer
9b15d01b29 fix implementation of Rotation::isSame(const Rotation& q, double tol) and extend Python bindings 2019-09-10 14:17:07 +02:00
Zheng, Lei
3fcbf71fb5 Base: misc patches
Convenience macros/function (in Interpreter.h)

* FC_PY_GetObject/Callable(), look for callables in a python object,
  which will be used in future patch to improve performance in various
  python observer/features.

* pyCall(WithKeywords)(), helper function to invoke the callable

Matrix4D:

* hasScale(), check if there is any scale in the transformation. If so,
  further check if the scale is uniform or not. This will be used in
  future patch for Part::TopoShape to decide which type of transform to
  apply.

Placement:

* translate/rotate(), new convenience API

Rotation:

* isSame/multiVec(), new convenience API

Polygon2d:

* Intersect(), GetCenter(), new convenience API.

FlagToggler:

* New class for exception safe flag toggling, similar to StateLocker
  but with template (actually, FlagToggler is added earlier by me).

BitsetLocker:

* New class for exception manipulation of a std::bitset variable.
2019-08-17 14:52:08 +02:00
wmayer
df05840212 handle gimbal lock when converting between quaternion and Euler angles (issue #0004062) 2019-07-22 16:31:42 +02:00
wmayer
28b195d6e2 PVS issues:
consistently define copy constructor and assignment operator
remove superfluous casts
initialize member variables in constructor
avoid double assignment
2019-03-04 11:53:49 +01:00
luz.paz
11b8f91c5d Misc. typos 2018-01-27 19:43:18 +01:00
wmayer
83fe8f8c36 fix OpenSCAD importer 2018-01-01 16:45:06 +01:00
wmayer
b22f231345 fix invalid syntax 2017-12-13 17:24:39 +01:00
wmayer
25bf33077e rename Placement.isNull to Placement.isIdentity
implement Rotation.isNull and Rotation.isIdentity
2017-12-13 17:00:38 +01:00
wmayer
a19faf16f7 preserve length of rotation axis 2017-12-13 17:00:38 +01:00
wmayer
aa201cba9c improve whitespaces 2017-12-13 17:00:38 +01:00
plgarcia
31c0230659 Improvement of rotations
Rotation:
-	Add a private attribute Vector to store the direction of the rotation, and manage not to erase this direction when the angle id 0.
-	Add a private attribute to store the angle as defined (no modulo etc)
-	Keep the quaternion for calculations

PropertyGeo
-	Saves the rotation with angle and direction instead of saving the quaternion.
-	Attribute name chosen: Ox, Oy and Oz for the coordinates of the axis and A for the angle in radians. This has to be validated.
-	Backward compatibility with the saved files with quaternion (test presence of A to determine which of  the Quaternion (old way) or the direction and angle is stored (new way). New files can be opened by old FreeCAD and vice-versa.

The only side effect I can imagine is that it was possible to set a vector to 0, 0, 0 if the angle was not 0, what is somehow non sense. Now when setting to 0, 0 0 the last not null vector is kept. The vector can not be null any longer.
2017-12-13 17:00:38 +01:00
DeepSOIC
96f3f0fa26 Base: new Rotation constructor - on vectors
The new constructor accepts wanted directions of x,y,z axes of rotated
frame, and a priority string that affects how the vectors are made
perpendicular to each other.

Example - construct placement for sketch on XZ plane:

v = App.Vector
App.Rotation(v(1,0,0),v(0,0,1),v())
2017-09-10 18:31:40 +02:00
wmayer
aea769af3d use a stricter tolerance to check for equal points
add method IsEqual to Vector3 class to support user-defined tolerance
2016-08-15 14:09:26 +02:00
wmayer
885050d33e + fix == operator of Rotation class, + add method isSame() 2016-05-18 18:08:40 +02:00
wmayer
dd2b39ddd6 + fixes #0002075: Analysis of FreeCAD by PVS-Studio static analyzer 2015-05-01 16:56:31 +02:00
wmayer
0950b33014 + issue #0002007: Base::Rotation::get/setYawPitchRoll uses wrong euler convention 2015-03-15 18:53:03 +01:00
wmayer
eed06ccc1d + Replace floats with doubles 2014-02-26 16:27:28 +01:00
wmayer
5a94eed5c0 + fix bug in Rotation::normalize()
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5155 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-11-22 12:51:50 +00:00