Button
This post is part of a course on geometric modeling at the Summer Liberal Arts Institute for Computer Science held at Carleton College in 2021.
Here’s an unsung hero whose worth isn’t recognized until it’s gone:
Just in case you lose one and need to print a replacement, you should have a 3D model of a button available.
Write a function named generateButton to generate the kind of shape you see in the image above. Have it accept these parameters:
- An integer 
nlongitudesthat specifies the number of lines of longitude that the cylinder has. Higher numbers won’t have much of an effect on the appearance. - The 
heightof the button, which measures the cylindrical height. - The 
majorRadiusof the button, which marks the distance from the y-axis to the outer rim. - The 
minorRadiusof the button, which marks the distance from the y-axis to the inner rim. - The 
holeRadiusof the button, which measures the size of a thread hole. - The 
holeGapof the button, which measures the distance between thread holes. 
Use boolean operations to create your button.