- #1
Sintrinsic
- 3
- 0
Fist, this is for a personal project of mine, I've been out of school for some time, and all my old math skills seem to have abandoned me. For that reason, and because I have to translate anything I learn into functions compatible with c#'s math library, it'd probably be best to keep any answers as simple as possible. lol *sigh*
What I need to do, with absolute accuracy, is this:
1.) Create 2 almost normalized vectors originating from 2 predetermined corners of a cube, and with a common destination of a known(but randomly generated) point.
2.) Discard the original "target" point.
3.) Using only the newly defined vectors, "reconstitute" the original point from the imaginary intersection of the vectors.
The problem I'm facing:
1.) I need to save space without loosing accuracy, and I'd LIKE to find two vectors with integral x,y,z values. I could just adjust one axis to 1 and have my program incrementally cycle upward until the remaining axes become integral, but that could be very time consuming. I need a way to consistently find such an integral vector with a single function or set of functions. Points with a roughly limited number of decimal digits would also be acceptable, if the likelihood of purely integral points is too low.
The process I have so far, which only seems to work on perfectly diagonal points. lol If you can improve, simplify, or speed up (for a computer) any of this, feel free:
Vector = destination - origin
Unit Vector = (Vector/Sqrt(Add(Vector^2)))*100 << to give room for integral vector
Least Integral Vector = UnitVector/(Gcd(Abs(UnitVector)))
Intersect Point = Determinant({(Origin2-Origin1),Vector2,CrossProduct(Vector1, Vector2)}) / (CrossProduct(Vector1,Vector2)^2)
I wrote all of the above on Yacas, which has been wonderful for teaching myself math, ( http://yacas.sourceforge.net/homepage.html), but it's too slow to use in the final program, so I won't have the benefit of the pre-defined functions. Thanks a ton in advance, I've been wracking my brain for the last 12 hours on this, just today, and I think my brain may explode if I can't solve the problem.
What I need to do, with absolute accuracy, is this:
1.) Create 2 almost normalized vectors originating from 2 predetermined corners of a cube, and with a common destination of a known(but randomly generated) point.
2.) Discard the original "target" point.
3.) Using only the newly defined vectors, "reconstitute" the original point from the imaginary intersection of the vectors.
The problem I'm facing:
1.) I need to save space without loosing accuracy, and I'd LIKE to find two vectors with integral x,y,z values. I could just adjust one axis to 1 and have my program incrementally cycle upward until the remaining axes become integral, but that could be very time consuming. I need a way to consistently find such an integral vector with a single function or set of functions. Points with a roughly limited number of decimal digits would also be acceptable, if the likelihood of purely integral points is too low.
The process I have so far, which only seems to work on perfectly diagonal points. lol If you can improve, simplify, or speed up (for a computer) any of this, feel free:
Vector = destination - origin
Unit Vector = (Vector/Sqrt(Add(Vector^2)))*100 << to give room for integral vector
Least Integral Vector = UnitVector/(Gcd(Abs(UnitVector)))
Intersect Point = Determinant({(Origin2-Origin1),Vector2,CrossProduct(Vector1, Vector2)}) / (CrossProduct(Vector1,Vector2)^2)
I wrote all of the above on Yacas, which has been wonderful for teaching myself math, ( http://yacas.sourceforge.net/homepage.html), but it's too slow to use in the final program, so I won't have the benefit of the pre-defined functions. Thanks a ton in advance, I've been wracking my brain for the last 12 hours on this, just today, and I think my brain may explode if I can't solve the problem.