diff --git a/include/cinder/GeomIo.h b/include/cinder/GeomIo.h index 5438dcec4c..02d04de554 100644 --- a/include/cinder/GeomIo.h +++ b/include/cinder/GeomIo.h @@ -528,9 +528,11 @@ class CI_API Torus : public Source { //! Allows you to twist the torus along the ring. The \a offset is in radians. Torus& twist( unsigned twist, float offset ) { mTwist = twist; mTwistOffset = offset; return *this; } //! Specifies the major and minor radius as a ratio (minor : major). Resulting torus will fit unit cube. - Torus& ratio( float ratio ) { ratio = math::clamp( ratio ); mRadiusMajor = 1; mRadiusMinor = 1 - ratio; return *this; } - //! Specifies the major and minor radius separately. + Torus& ratio( float ratio ) { ratio = math::clamp( ratio ); mRadiusMajor = 1; mRadiusMinor = ratio; return *this; } + //! Specifies the major and minor radius separately. \a major is the distance from the axis to the farthest point of the torus. \a minor is the distance between the axis and the center of the rotated circle. Torus& radius( float major, float minor ) { mRadiusMajor = math::max(0, major); mRadiusMinor = math::max(0, minor); return *this; } + //! Sets the radii for a torus that is generated by revolving a small circle of radius \a r along the axis made by a bigger circle of radius \a R. + Torus& radiusCentered( float R, float r ) { mRadiusMajor = math::max(0, R + r); mRadiusMinor = math::max(0, R); return *this; } size_t getNumVertices() const override; size_t getNumIndices() const override; @@ -1150,9 +1152,11 @@ class CI_API WireTorus : public WireSource { //! Specifies the number of segments that make up each circle. Defaults to \c 72. WireTorus& subdivisionsCircle( int subdiv ) { mNumSegments = math::max( 3, subdiv ); return *this; } //! Specifies the major and minor radius as a ratio (minor : major). Resulting torus will fit unit cube. - WireTorus& ratio( float ratio ) { ratio = math::clamp( ratio ); mRadiusMajor = 1; mRadiusMinor = 1 - ratio; return *this; } - //! Specifies the major and minor radius separately. + WireTorus& ratio( float ratio ) { ratio = math::clamp( ratio ); mRadiusMajor = 1; mRadiusMinor = ratio; return *this; } + //! Specifies the major and minor radius separately. \a major is the distance from the axis to the farthest point of the torus. \a minor is the distance between the axis and the center of the rotated circle. WireTorus& radius( float major, float minor ) { mRadiusMajor = math::max( 0, major ); mRadiusMinor = math::max( 0, minor ); return *this; } + //! Sets the radii for a torus that is generated by revolving a small circle of radius \a r along the axis made by a bigger circle of radius \a R. + WireTorus& radiusCentered( float R, float r ) { mRadiusMajor = math::max(0, R + r); mRadiusMinor = math::max(0, R); return *this; } size_t getNumVertices() const override; void loadInto( Target *target, const AttribSet &requestedAttribs ) const override;