Need a C# function to calculate the Y value given the X value of a line
Bajet $10-30 USD
- Freelancer
- Kerja
- Pengaturcaraan C#
- Need a C# function to calculate the Y value given the X value of a line
I have a CNC program that I need to see how close the machine points are to multiple lines drawn over the same pattern. What I need is a function that I can pass the points (with the decimal places) for the start and end of the line and the x value I'm looking for the y value to and get the y value for that point on the line (if they are on the line). The function doesn't need to validate that they are on the line as I'll only be passing the ones on the line.
This is what I found online but it's not working the way I need it to.
public static double GetY(double x, double aX, double aY, double m)
{
// Vertical line (y-values are always the same)
if ([login to view URL](m))
return aY;
double c = (aY - aX) * m;
return m * x + c;
}
public static double CalculateSlope(double aX, double aY, double bX, double bY)
{
if (bY == aY)
return [login to view URL];
if (bX == aX)
return 0.0;
return (bY - aY) / (bX - aX);
}
aX = 594.7664
aY = 63.5246
bX = 140.0116
bY = 63.5118
x = 140.0116
y should be 63.5118 but it's actually returning 0.001747275146958124.
x = 200 also returns 0.0034357708373827563 for y.
aX = 140.4297
aY = 62.4948
bX = 140.8548
bY = 61.4806
x = 140.4297
y should be 62.4948 but is returning -149.0995675
I've attached two sample files that I need it to work for.
The Rough [login to view URL] file gives the points for the lines.
Each line is calculated using the point on the current line and the point on the next line.
The points that I need to calculate (assuming they fall between the x on the first line and x on the next line) are in Machine points.csv.
There are the x points that could fall on the line from Rough [login to view URL] and I need to calculate for each point what the value of Y is.
Dianugerahkan kepada:
Hi, Function already created, Done, Tested and Ready, Message me to get the formula/function, anyway you will pay after test
12 pekerja bebas membida secara purata $31 untuk pekerjaan ini
Hello Sir/ Ma’am A skilled full stack developer, I have rich experience in JAVA,C, C++, C#, Python, .NET , MYSQL, SQL, IONIC , MATLAB,PHP and ARDUINO. I am very confident with my skills and I'd like to help your bu Lagi
Hello How are you. Your project encourages me to help you with perfect result. I developed React js for long time, so your plan is just familiar with me. The main point is your decision to award me for your project. Yo Lagi
Hi, I am an export in C++, C#, Java and I have full experience over 10 years. I have good experience developing CNC programs using C++. I will do my best to finish your project in the shortest time with high qualit Lagi
HI. I am C# programmer and I just saw your posting. I have enough experience about C# programming. I am interested in your code and now I am analyzing your code. If I find the problem, I will contact you. Thank you.
Professional software developer️ Hello, I have confirmed your project requirements I hope you are safe and doing well. I would like to discuss further with you. We hope to see you soon to discuss further. Coming to me, Lagi
Hello, Client! I read your project description and code carefully. I'm a C/C++/python and math expert. I can do this task in a short time. I wish that to discuss with you in detail for this project. Best regards.