Subject:
|
Re: calc_z4.c (Was: Math Problem Again)
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Fri, 23 Oct 2009 08:31:51 GMT
|
Viewed:
|
17785 times
|
| |
| |
> // calc_z4 by Tore Eriksson
> // credits to Ronan Webb for the superb formula
> double calc_z4(double x1,double y1,double z1,
> double x2,double y2,double z2,
> double x3,double y3,double z3,
> double x4,double y4)
> {
> double a,b,c,minus_d,z4;
> a = y1*(z2-z3) + y2*(z3-z1) + y3*(z1-z2);
> b = z1*(x2-x3) + z2*(x3-x1) + z3*(x1-x2);
> c = x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2);
> minus_d = x1*(y2*z3-y3*z2) + x2*(y3*z1-y1*z3) + x3*(y1*z2-y2*z1);
> z4 = (minus_d - a*x4 - b*y4)/c;
> return z4;
> }
You also need a touch of code to catch when c=0 so that z4 is undefined ;)
Tim
|
|
Message has 1 Reply: | | Re: calc_z4.c (Was: Math Problem Again)
|
| In lugnet.cad.dev, Timothy Gould wrote: // calc_z4 by Tore Eriksson // credits to Ronan Webb for the superb formula double calc_z4(double x1,double y1,double z1, double x2,double y2,double z2, double x3,double y3,double z3, double x4,double y4) { (...) (15 years ago, 23-Oct-09, to lugnet.cad.dev)
|
Message is in Reply To:
| | calc_z4.c (Was: Math Problem Again)
|
| (...) Sorry guys, just wanted to store this function in a safer place than my hard drive. :) I just don't want to remake it again...! Feel free to copy/paste/edit/port if you need it! /Tore // calc_z4 by Tore Eriksson // credits to Ronan Webb for (...) (15 years ago, 22-Oct-09, to lugnet.cad.dev)
|
10 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|