Commit 584eded4 by Timo Koch

### Merge branch 'feature/embedded-circlep-separate-helper' into 'master'

```[md][embedded] Factor out sin/cos precomputation

See merge request !2536```
parents b05a5b67 a3e994d6
 ... ... @@ -82,21 +82,12 @@ void circlePoints(std::vector& points, /*! * \ingroup EmbeddedCoupling * \brief returns a vector of points on a circle * \param center the circle center * \param normal the normal to the circle plane * \param radius the circle radius * \brief returns a vector of sin and cos values of a circle parametrization * \param numPoints the number of points */ template std::vector circlePoints(const GlobalPosition& center, const GlobalPosition& normal, const Scalar radius, const std::size_t numPoints = 20) template std::vector circlePointsSinCos(const std::size_t numPoints) { std::vector points; // precompute the sin/cos std::vector sincos(2*numPoints); Scalar t = 0 + 0.1; // add arbitrary offset for (std::size_t i = 0; i < numPoints; ++i) ... ... @@ -107,7 +98,27 @@ std::vector circlePoints(const GlobalPosition& center, t += 2*M_PI/numPoints; if(t > 2*M_PI) t -= 2*M_PI; } return sincos; } /*! * \ingroup EmbeddedCoupling * \brief returns a vector of points on a circle * \param center the circle center * \param normal the normal to the circle plane * \param radius the circle radius * \param numPoints the number of points */ template std::vector circlePoints(const GlobalPosition& center, const GlobalPosition& normal, const Scalar radius, const std::size_t numPoints = 20) { // precompute the sin/cos values const auto sincos = circlePointsSinCos(numPoints); std::vector points; circlePoints(points, sincos, center, normal, radius); return points; } ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!