Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Calculate the rounding radius max value of a n-Side object

    General Talk
    c++ sdk
    2
    3
    491
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mfersaouiM
      mfersaoui
      last edited by

      Hi,
      I'm searching how to calculate the rounding radius maximum value of a n-Side object.
      I tried with the following but it doesn't work:

      Float calculateSide(Int32 n, Float r)
      {
      	Float theta, theta_in_radians;
      	theta = 360 / n;
      	theta_in_radians = theta * 3.14 / 180;
      	return 2 * r * sin(theta_in_radians / 2);
      }
      
      
      Float	max_rrad = calculateSide(n, r)/2;
      

      Thanks

      1 Reply Last reply Reply Quote 0
      • CairynC
        Cairyn
        last edited by

        Assuming you mean a regular polygon, the maximum rounding radius is the same as the incircle of the polygon (as at this point all roundings touch and form a circle).

        For formulas, see e.g.
        https://www.mathopenref.com/polygonincircle.html

        mfersaouiM 1 Reply Last reply Reply Quote 1
        • mfersaouiM
          mfersaoui @Cairyn
          last edited by mfersaoui

          @Cairyn
          Hi,
          Thank you.

          Solution:

          Float GeIncircle(Int32 n, Float r)
          {
          	return r * cos(PI / n);
          }
          
          Float	max_rrad = GeIncircle(n, r);
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post