62587f78baec2bf5d5e862909c845cfba75d2730,liegroups/se2.py,SE2,from_matrix,#,31
Before Change
@classmethod
def from_matrix(cls, mat):
Create a SE2 object from a 3x3 transformation matrix.
if not SE2.is_valid_matrix(mat):
raise ValueError("Invalid transformation matrix")
return cls(SO2(mat[0:2, 0:2]), mat[0:2, 2])
@classmethod
def is_valid_matrix(cls, mat):
After Change
@classmethod
def from_matrix(cls, mat, normalize=False):
Create a SE2 object from a 3x3 transformation matrix.
mat_is_valid = cls.is_valid_matrix(mat)
if mat_is_valid:
result = cls(SO2(mat[0:2, 0:2]), mat[0:2, 2])
elif not mat_is_valid and normalize:
result = cls(SO2(mat[0:2, 0:2]), mat[0:2, 2])
result.normalize()
else:
raise ValueError(
"Invalid transformation matrix. Use normalize=True to handle rounding errors.")
return result
@classmethod
def is_valid_matrix(cls, mat):
Check if a matrix is a valid transformation matrix.
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 11
Instances
Project Name: utiasSTARS/liegroups
Commit Name: 62587f78baec2bf5d5e862909c845cfba75d2730
Time: 2017-08-28
Author: clement.leopold@gmail.com
File Name: liegroups/se2.py
Class Name: SE2
Method Name: from_matrix
Project Name: utiasSTARS/liegroups
Commit Name: 62587f78baec2bf5d5e862909c845cfba75d2730
Time: 2017-08-28
Author: clement.leopold@gmail.com
File Name: liegroups/so2.py
Class Name: SO2
Method Name: from_matrix
Project Name: utiasSTARS/liegroups
Commit Name: 62587f78baec2bf5d5e862909c845cfba75d2730
Time: 2017-08-28
Author: clement.leopold@gmail.com
File Name: liegroups/so3.py
Class Name: SO3
Method Name: from_matrix
Project Name: utiasSTARS/liegroups
Commit Name: 62587f78baec2bf5d5e862909c845cfba75d2730
Time: 2017-08-28
Author: clement.leopold@gmail.com
File Name: liegroups/se2.py
Class Name: SE2
Method Name: from_matrix
Project Name: utiasSTARS/liegroups
Commit Name: 62587f78baec2bf5d5e862909c845cfba75d2730
Time: 2017-08-28
Author: clement.leopold@gmail.com
File Name: liegroups/se3.py
Class Name: SE3
Method Name: from_matrix