Skip to content

Conversation

@VyasGuru
Copy link

Optimize point class arithmetic

Summary

This PR introduces significant performance optimizations to the core point class.

Changes

Performance Optimizations

  • File: include/cartesian_geom/point.h
  • 1-> (squared_length):
    • Replaced return length() * length() with return coeffs.squaredNorm().
    • Benefit: Eliminates an expensive square root instruction followed by a multiplication. This improves performance for distance-based checks and increases precision by avoiding floating-point errors.
  • 2->(Overloading):
    • Added template overloads for operator+= and operator-= that accept Eigen::MatrixBase<Derived>.
    • Benefit: Enables lazy evaluation, improving performance by reducing memory load.

Adresses #434
@vissarion please do look into this if there are any further changes to be made.

@VyasGuru VyasGuru closed this Jan 28, 2026
@vissarion vissarion mentioned this pull request Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant