Skip to content

Commit

Permalink
[visual] Fully remove scale, adapt python bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
arntanguy committed Feb 2, 2024
1 parent 46aa32c commit 8da227a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion binding/python/rbdyn/parsers/c_parsers.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cdef extern from "<RBDyn/parsers/common.h>" namespace "rbd::parsers":

cdef cppclass GeometryMesh "rbd::parsers::Geometry::Mesh":
string filename
double scale
Vector3d scaleV

cdef cppclass GeometryBox "rbd::parsers::Geometry::Box":
Vector3d size
Expand Down
8 changes: 4 additions & 4 deletions binding/python/rbdyn/parsers/parsers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ cdef class GeometryMesh(object):
property filename:
def __get__(self):
return self.impl.filename
property scale:
property scaleV:
def __get__(self):
return self.impl.scale
return eigen.Vector3dFromC(self.impl.scaleV)

def __richcmp__(GeometryMesh self, GeometryMesh other, int op):
if op == 2:
return (
self.impl.filename == other.impl.filename
and self.impl.scale == other.impl.scale
and self.impl.scaleV == other.impl.scaleV
)
elif op == 3:
return (
self.impl.filename != other.impl.filename
and self.impl.scale != other.impl.scale
and self.impl.scaleV != other.impl.scaleV
)
else:
raise NotImplementedError("This comparison is not supported")
Expand Down
4 changes: 1 addition & 3 deletions src/parsers/yaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,11 @@ bool RBDynFromYAML::parseGeometry(const YAML::Node & geometry, Geometry & data)
if(maybeScaleV.size() == 3)
{
mesh_data.scaleV = Eigen::Map<Eigen::Vector3d>(maybeScaleV.data(), 3);
mesh_data.scale = mesh_data.scaleV(2);
}
else
{
assert(maybeScaleV.size() == 1);
mesh_data.scale = maybeScaleV[0];
mesh_data.scaleV.setConstant(mesh_data.scale);
mesh_data.scaleV.setConstant(maybeScaleV[0]);
}
has_geometry = true;
data.data = mesh_data;
Expand Down

0 comments on commit 8da227a

Please sign in to comment.