@@ -263,6 +263,38 @@ inline tesseract_geometry::ConvexMesh::Ptr makeConvexMesh(const tesseract_geomet
263263 return std::make_shared<tesseract_geometry::ConvexMesh>(ch_vertices, ch_faces, ch_num_faces);
264264}
265265
266+ /* *
267+ * @brief Apply scaling to the geometry coordinates.
268+ * @details Given a scaling factor s, and center c, a given vertice v is transformed according to s (v - c) + c.
269+ * @param vertices The vertices to scale
270+ * @param center The point at which to scale the data about
271+ * @param scale The scale factor to apply to the vertices.
272+ */
273+ inline void scaleVertices (tesseract_common::VectorVector3d& vertices,
274+ const Eigen::Vector3d& center,
275+ const Eigen::Vector3d& scale)
276+ {
277+ for (auto & v : vertices)
278+ v = scale.cwiseProduct (v - center) + center;
279+ }
280+
281+ /* *
282+ * @brief Apply scaling to the geometry coordinates.
283+ * @details Given a scaling factor s, and center c, a given vertice v is transformed according to s (v - c) + c.
284+ * @param vertices The vertices to scale
285+ * @param scale The scale factor to apply to the vertices.
286+ */
287+ inline void scaleVertices (tesseract_common::VectorVector3d& vertices, const Eigen::Vector3d& scale)
288+ {
289+ Eigen::Vector3d center (0 , 0 , 0 );
290+ for (const auto & v : vertices)
291+ center = center + v;
292+
293+ center = (1.0 / static_cast <double >(vertices.size ())) * center;
294+
295+ scaleVertices (vertices, center, scale);
296+ }
297+
266298/* *
267299 * @brief Write a simple ply file given vertices and faces
268300 * @param path The file path
0 commit comments