Posts for: #Chamfer

Chamfer Calculator in C

I’ve converted the Rust Chamfer Calculator to C for shits and giggles, and to learn something new. If you have any recommendations on tutorials for C socket programming, please feel free to contact me. Without further ado, here’s my garbage:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double to_radians(double degrees);
double chamf(double angle, double depth, double bore);

int main(int argc, char *argv[])
{
        if (argc < 4 || argc > 4)
        {
                printf("Usage: %s angle depth bore\n", argv[0]);
                exit(0);
        }

        double ang = strtod(argv[1], NULL);
        double dep = strtod(argv[2], NULL);
        double bor = strtod(argv[3], NULL);

        double cha = chamf(ang, dep, bor);

        printf("Angle: %f\nDepth: %f\nBore: %f\nChamfer Diameter:
%.16f\n", ang, dep, bor, cha);

        exit(0);
}

double to_radians(double degrees)
{
        return degrees * (M_PI / 180);
}

double chamf(double angle, double depth, double bore)
{
        return (tan(to_radians(angle)) * depth) + bore;
}
[]

Chamfer Calculator in Rust

I’m going to go through my old TI-82 calculator and rewrite my most useful little trig tidbits in Rust for everyone to use. The first one I’m going to reiterate will be my chamfer calculator. This is pretty handy if you ever have to measure chamfer diameters in a production environment. You can quickly calculate the greatest diameter of any given print dimension chamfer with this tool. It ought to compile on the latest version of Rust without warning. Should. I’ve hit my Ballmer curve, so I’ll just throw that warning right away.

[]