EDN Admin
Well-known member
Hello Guys,
The question i am asking is , i have a set of 2d points but large number of them ( about 600 points) i extracted them from a text file to c++ vector<point> where point is a structure i defined... now the problem is i want the following:
1) get the value of x on the spline knowing y
2) get the value of y knowing x
3) get the intersection between the spline & a line i have its equation & note that the line boundary in x direction lies between the spline , i.e i am sure that the line x_coordinates of starting point & end point lies between X_values boundaries of spline
so , any help? & if it isnt possible to do so with spline & i might with the function Polygon(); how can i do the same above??
I read Charlez Petzolds book / chapter 5 "Drawing Basics" & he mentioned the parametric function of Bezier line , so if someone could tell how to substitute in it & use it well , i might figure out the answer , i.e "How can i use these eqn with a pencil & paper to draw the spline with my hands on a set of paper "
The functions as mentioned in petzolds book :
x(t)=(1-t)^3*xo+3t(1-t)^2 x_1+3t^2 (1-t) * x_2+t^3 * x_3
y(t)=(1-t)^3*yo+3t(1-t)^2 y_1+3t^2 (1-t) * y_2+t^3 * y_3
where x_1 means: x sub 1
(xo,yo) ----> start point , (x3,y3)--->end point
(x1,y1) & (x2,y2) --> control points
Thanks in advance
View the full article
The question i am asking is , i have a set of 2d points but large number of them ( about 600 points) i extracted them from a text file to c++ vector<point> where point is a structure i defined... now the problem is i want the following:
1) get the value of x on the spline knowing y
2) get the value of y knowing x
3) get the intersection between the spline & a line i have its equation & note that the line boundary in x direction lies between the spline , i.e i am sure that the line x_coordinates of starting point & end point lies between X_values boundaries of spline
so , any help? & if it isnt possible to do so with spline & i might with the function Polygon(); how can i do the same above??
I read Charlez Petzolds book / chapter 5 "Drawing Basics" & he mentioned the parametric function of Bezier line , so if someone could tell how to substitute in it & use it well , i might figure out the answer , i.e "How can i use these eqn with a pencil & paper to draw the spline with my hands on a set of paper "
The functions as mentioned in petzolds book :
x(t)=(1-t)^3*xo+3t(1-t)^2 x_1+3t^2 (1-t) * x_2+t^3 * x_3
y(t)=(1-t)^3*yo+3t(1-t)^2 y_1+3t^2 (1-t) * y_2+t^3 * y_3
where x_1 means: x sub 1
(xo,yo) ----> start point , (x3,y3)--->end point
(x1,y1) & (x2,y2) --> control points
Thanks in advance
View the full article