float graph = -( 1.0 /(0.5*0.5))*( t - 0.5 )*( t - 0.5 ) + 2.0;
when t=0, graph = 1.0.
put_line: this->print_lines_num=2 put_line: this->print_lines_num=3 PointLinear::put_line ENDS. i: 3 vLine: 0042002D 00420030 vPointLinear::put_line STARTS. put_line: this->print_lines_num=3 put_line: this->print_lines_num=4 PointLinear::put_line ENDS. i: 4 vLine: 0042002D 00420030 vPointLinear::put_line STARTS. put_line: this->print_lines_num=4 put_line: this->print_lines_num=5 PointLinear::put_line ENDS. i: 5 vLine: 0042002D 00420030 vPointLinear::put_line STARTS. put_line: this->print_lines_num=5 put_line: this->print_lines_num=6 PointLinear::put_line ENDS. this->print_lines_num = 6 vPointLinear::generateControls(): ENDS CurveLines->print_lines_num= 6 void vPointLinear::CurveRevisement () STARTS int vPointLinear::CurveRevisement: i= 0/ 5 vCurveCalculation::BattleField: |03B17D50|03B2CF60|03B2CB40|03B17DB0|p5=p( -110.000000, 0.000000, 100.000000) p7=p( -76.704559, 11.244169, 119.104500) curve_point=p( -36.448689, 24.838936, 142.202805) blend=p( -73.224342, 12.419468, 121.101402) blend_001=p( -146.448685, 24.838936, 242.202805) point=p( -110.000000, 0.000000, 100.000000) graph=1.000000 t=0.000000 vCurveCalculation::BattleField: |03B2D7F8|
float graph = -( 1.0 /(0.5*0.5))*( t - 0.5 )*( t - 0.5 ) + 1.0; if t=0, graph=0.
put_line: this->print_lines_num=3 put_line: this->print_lines_num=4 PointLinear::put_line ENDS. i: 4 vLine: 0042002D 00420030 vPointLinear::put_line STARTS. put_line: this->print_lines_num=4 put_line: this->print_lines_num=5 PointLinear::put_line ENDS. i: 5 vLine: 0042002D 00420030 vPointLinear::put_line STARTS. put_line: this->print_lines_num=5 put_line: this->print_lines_num=6 PointLinear::put_line ENDS. this->print_lines_num = 6 vPointLinear::generateControls(): ENDS CurveLines->print_lines_num= 6 void vPointLinear::CurveRevisement () STARTS int vPointLinear::CurveRevisement: i= 0/ 5 vCurveCalculation::BattleField: |03B77DC8|03B8D020|03B8CB28|03B77E28|p5=p( -110.000000, 0.000000, 100.000000) p7=p( -0.000000, 0.000000, 0.000000) curve_point=p( 0.000000, 0.000000, 0.000000) blend=p( -55.000000, 0.000000, 50.000000) blend_001=p( -110.000000, 0.000000, 100.000000) point=p( -110.000000, 0.000000, 100.000000) graph=0.000000 t=0.000000 vCurveCalculation::BattleField: |03B8D4E0|
displayed:
p7=p( -73.636375, 10.794402, 114.340317) curve_point=p( -34.990742, 23.845377, 136.514679) blend=p( -33.495369, 26.922689, 148.257339) blend_001=p( -66.990738, 53.845379, 296.514679) point=p( -31.999996, 30.000002, 160.000000) graph=0.960000 t=0.600000 vCurveCalculation::BattleField: |03B3D7C8| curve_p : |03B3D7C8| i= 4/ 5 vCurveCalculation::BattleField: |03B27D38|03B3CEA0|03B3CBA p7=p( -49.090916, 7.196268, 76.226875) curve_point=p( -23.327160, 15.896918, 91.009789) blend=p( -14.663579, 27.948460, 135.504898) blend_001=p( -29.327158, 55.896919, 271.009796) point=p( -5.999998, 40.000000, 180.000000) graph=0.640000 t=0.800000 vCurveCalculation::BattleField: |03B3F6C8|
only linear returned, we did.
.\vCurveCalculation.cpp Mon Dec 30 23:06:24 2019 1 :#include2 :#include 3 :#include // ADD: 20191230 4 : 5 :#include "array_counter.h" // ADD: 20191230 6 :#include "sender.h" // ADD: 20191230 7 :#include "Print.h" // ADD: 20191230 8 : 9 :#include "vPoint.h" 10 :#include "vLine.h" 11 :#include "vCalculation.h" 12 :#include "vCurveCalculation.h" 13 : 14 :// 15 :// 16 :// 17 :// 18 :// 19 :vPoint* vCurveCalculation::BattleField (vPoint* p1, vPoint* p2, vPoint* p3, vPoint* p4, float t) { 20 : vCalculation* calc = nullptr; 21 : 22 : printf("vCurveCalculation::BattleField: |%p|%p|%p|%p|", p1, p2, p3, p4 ); 23 : // calculation, revisement 24 : float tt = t*t; 25 : float c=2.0f; 26 : 27 : // Linear 28 : vPoint* p5 = calc->scalize( p1, (1.0f - t) ); // anchor p1 29 : vPoint* p6 = calc->scalize ( p4, t ); // anchor p4 30 : 31 : vPoint* point = calc->add ( p5, p6 ); 32 : 33 : //consider, p2 and p3 which are controls points. 34 : // Curve 35 : // if t=0: 36 : // curve_point=p1: 37 : // p2=0: 38 : // p3=0: 39 : // if t=1: 40 : // curve_point=p4: 41 : // p2=0: 42 : // p3=0: 43 : float graph = -( 1.0 /(0.5*0.5))*( t - 0.5 )*( t - 0.5 ) + 1.0; 44 : vPoint* p7 = calc->scalize ( p2, graph ); 45 : vPoint* p8 = calc->scalize ( p3, graph ); 46 : vPoint* curve_point_001 = calc->add ( p7, p8 ); 47 : vPoint* curve_point = calc->scalize( curve_point_001, 0.5f); 48 : 49 : // Linear + Curve: Blend 50 : // Debug 51 : //vPoint* blend_001 = calc->add( curve_point, point ); 52 : vPoint* blend_001 = calc->add( curve_point, point ); 53 : vPoint* blend = calc->scalize( blend_001, 0.5f); 54 : 55 : level_error_msg = 2; 56 : // Calculated points printed. 57 : log_msg_003("p5="); 58 : p5->print(); 59 : log_msg_003("p7="); 60 : p7->print(); 61 : 62 : log_msg_003("curve_point="); 63 : curve_point->print(); 64 : log_msg_003("blend="); 65 : blend->print(); 66 : log_msg_003("blend_001="); 67 : blend_001->print(); 68 : log_msg_003("point="); 69 : point->print(); 70 : log_msg_003("graph=%f t=%f\r\n", graph, t); 71 : level_error_msg = 3; 72 : 73 : 74 : printf("vCurveCalculation::BattleField: |%p|\r\n", blend ); 75 : 76 : //if ( t>0.8 ) exit(-1); //20191230 77 : 78 :// return point; 79 : return p7; 80 : 81 :// return curve_point; 82 :} 83 : 84 :// p1: Anchor 85 :// p2: setting controls 86 :// 87 :// p3: Anchor(next) 88 :// p4: setting controls 89 :// 90 :// vCurveCalculation 91 :// Position 92 :/* vPoint* vCurveCalculation::Position (vPoint* p1, vPoint* p2, vPoint p3, vPoint* p4, float t) { 93 : vCalculation* calc = nullptr; 94 : 95 : // calculation, revisement 96 : float tt = t*t; 97 : 98 : vPoint* p5 = calc->multiple ( p1, 1 - tt ); 99 : vPoint* p6 = calc->multiple ( p3, tt ); 100 : 101 : vPoint point calc->add ( p5, p6 ); 102 : 103 : //consider, p2 and p3 which is controls point. 104 : 105 : return point; 106 :}*/ 107 :
Connections must be from C1 to C1 and from C2 to C2.
we could not understand where lines go, which is just one point and might be O(0,0,0).
Additional elemets to Linear, which means Curve, so, if t=0 and t=1.0, p8 must be O( 0, 0, 0) means calculatons were right.