Commit Graph

35 Commits

Author SHA1 Message Date
wmayer
513ef44a13 Base: add methods to transform a Vector3f with a Rotation or Placement 2022-08-04 11:45:39 +02:00
wmayer
8abd40a788 Base: [skip ci] use Precision class in Rotation::makeRotationByAxes 2022-07-30 17:21:59 +02:00
wmayer
97f9320bb3 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
af94c6c9b7 Base: Set angle in Rotation::inverse function 2022-06-19 15:44:05 +02:00
wmayer
80c900cf52 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
4183c45a01 Base: modernize C++11
* use nullptr
2022-03-23 16:57:25 +01:00
wmayer
4a343ab31e 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
686a025416 [Base] Quantity, Rotation, Stream: remove unused includes 2022-03-01 11:27:54 +01:00
wmayer
cad0d01883 Base: modernize C++11
* remove redundant void-arg
* use nullptr
* replace deprecated headers
2022-01-25 20:21:30 +01:00
wmayer
b803d987b9 Base: [skip ci] handle gimbal lock when computing Euler angles 2021-10-27 17:02:07 +02:00
0penBrain
419612d63e [Core] Rotation : improve gimbal lock handling
Tolerance copied from OCC "gp_Quaternion.cxx"
2021-09-27 16:52:21 +02:00
0penBrain
cdbf7acc80 [Core] Rotation : fix gimbal lock handling
+ fix Euler representation on GUI
2021-09-13 18:34:58 +02:00
Zheng, Lei
37d6752404 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
01b21e0d06 Base: Fix header uniformity, whitespace, and doxygen
[skip ci]
2020-11-22 18:12:16 +01:00
luz.paz
ae72e2c762 Trivial code formatting for some {.cpp,.h} files 2020-04-06 12:55:27 +02:00
wmayer
52916175ed 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
3726006942 fix implementation of Rotation::isSame(const Rotation& q, double tol) and extend Python bindings 2019-09-10 14:17:07 +02:00
Zheng, Lei
2d9ca92594 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
d1b47718cf handle gimbal lock when converting between quaternion and Euler angles (issue #0004062) 2019-07-22 16:31:42 +02:00
wmayer
6b37fdc1a8 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
436444b424 Misc. typos 2018-01-27 19:43:18 +01:00
wmayer
b9975a5e14 fix OpenSCAD importer 2018-01-01 16:45:06 +01:00
wmayer
7991e1ae7e fix invalid syntax 2017-12-13 17:24:39 +01:00
wmayer
df0a3ded78 rename Placement.isNull to Placement.isIdentity
implement Rotation.isNull and Rotation.isIdentity
2017-12-13 17:00:38 +01:00
wmayer
ab908bf22d preserve length of rotation axis 2017-12-13 17:00:38 +01:00
wmayer
3692861136 improve whitespaces 2017-12-13 17:00:38 +01:00
plgarcia
a0ea3ceec9 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
62b0d35270 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
4d77921111 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
f3226a0867 + fix == operator of Rotation class, + add method isSame() 2016-05-18 18:08:40 +02:00
wmayer
859d76faf8 + fixes #0002075: Analysis of FreeCAD by PVS-Studio static analyzer 2015-05-01 16:56:31 +02:00
wmayer
9d70e9c0ce + issue #0002007: Base::Rotation::get/setYawPitchRoll uses wrong euler convention 2015-03-15 18:53:03 +01:00
wmayer
0b0a57a4eb + 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
wmayer
120ca87015 + unify DLL export defines to namespace names
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 13:44:52 +00:00