Hello!
I am struggling a bit with something I think should be easy:
fn drawline<T: Sub<Output = T> + Div<Output = T>> (start: T3<T>, end: T3<T>, n: i64){
// Distance between end and start points
let d = end - start;
// How many points between limits
let nd = n as T;
// Construct nd as T3
let ndt = T3::<T>::new(nd,nd,nd);
// Step size between points as T3
let dp = d / ndt;
}
Basically what I have is a tuple, "T3" with a type "T", which will most oftenly be either f32 or f64. I want to draw a line between two points of type "T3" and the total number of points is given by "n" which is of type "i64". I need to be able to convert from "i64" to "T", to ensure that the line "let nd = n as T" will work (does not work currently).
Am I approaching this in a wrong way or how would I go about doing it?
A small and easy solution is simply to set "n: T" in the function definition, but I would like to avoid errors by mistype "n = 472.2" points, which would not make sense, since I cannot have "0.2" particle.
Kind regards