/ ************************************************** ********************* REVISION log entry revision by: http://blog.9cbs.net/hongweijin revised on: 2004-10-22 5:34 : 30 Comments: Interpolation simulation algorithm for the second curve ******************************************************** ******************************* /
#include "stdio.h" #include "stdlib.h"
Void main (void) {INT i; double t; double x;
/ * P0 is a vertex, P1 is determined by the third point, P2 is the second point determined * / float p0 [2], p1 [2], p2 [2];
Printf ("Enter the first point of coordinate x:"); scanf ("% f", & p0 [0]); Printf ("Enter the first point coordinate Y:"); scanf ("% f", & p0 [ 1]); Printf ("/ N Enter the second point of coordinate x:"); scanf ("% f", & p1 [0]); Printf ("Enter the second point coordinate Y:"); scanf (" % f ", & p1 [1]); Printf (" / n Enter the third point of coordinate x: "); scanf ("% f ", & p2 [0]); Printf (" Enter the third point of coordinate Y: "); Scanf ("% f ", & p2 [1]); for (i = 0; i <10000; i ) {t = I / 10000.0;
X = (1-t) * (1-t) * p0 [0] (2 * t) * (1-t) * p1 [0] T * T * p2 [0]; printf ("% f , ", x); x = (1-t) * (1-t) * p0 [1] (2 * t) * (1-t) * p1 [1] T * T * p2 [1] PRINTF ("% f / n", x);}} / ****************************************************** *************************************************************** Revision log entry revision by: http://blog.9cbs .值 模 模 模 模 模 模 模 模 模 模 模 模 模 模 模 模 模****************************************************** /
#include "stdio.h" #include "stdlib.h"
Void main (void) {INT i; double t; double x;
/ * P0 is a vertex, P1 is determined by the third point, P2 is the second point determined * / float p0 [2], p1 [2], p2 [2], p3 [2];
Printf ("Enter the first point of coordinate x:"); scanf ("% f", & p0 [0]); Printf ("Enter the first point coordinate Y:"); scanf ("% f", & p0 [ 1]); Printf ("/ N Enter the second point of coordinate x:"); scanf ("% f", & p1 [0]); Printf ("Enter the second point coordinate Y:"); scanf (" % f ", & p1 [1]); Printf (" / n Enter the third point of coordinate x: "); scanf ("% f ", & p2 [0]); Printf (" Enter the third point of coordinate Y: "); Scanf ("% f ", & p2 [1]); Printf (" / N inputs 4th point coordinate x: "); scanf ("% f ", & p3 [0]); Printf (" input Four coordinates Y: "); scanf ("% f ", & p3 [1]); for (i = 0; i <100; i ) {t = I / 100.0; x = (1-t) * ( 1-T) * (1-t) * p0 [0] (3 * t) * (1-t) * (1-t) * p1 [0] 3 * t * t * (1-t) * P2 [0] T * T * T * p3 [0]; Printf ("% f,", x); x = (1-t) * (1-t) * (1-t) * P0 [ 1] (3 * t) * (1-T) * (1-T) * p1 [1] 3 * t * t * (1-t) * p2 [1] T * t * t * p3 [1]; Printf ("% f / n", x);}}