Switch to full style
C++ code examples
Post a reply

Draw Hermite Curve

Fri Jul 27, 2012 10:31 pm

Draw Hermite Curve using C++ with MFC :

Code:

    vector
<doublexCof GetHermiteCoeff(P0.firstT0.firstP3.firstT1.first);
    
vector<doubleyCof GetHermiteCoeff(P0.secondT0.secondP3.secondT1.second);

    if(
numPix 2) return;
    
double dt 1.0 / (numPix 1);

    
tagLOGPEN tp;
    
tp.lopnColor color;
    
tp.lopnStyle PS_SOLID;
    
tp.lopnWidth.1;
    
HPEN p CreatePenIndirect(&tp);
    
SelectObject(hdcp);
    for(
double t 0<= 1+= dt)
    {
        
vector<doublevt(4);
        
vt[3] = 1;
        
vt[2] = t*vt[3];
        
vt[1] = t*vt[2];
        
vt[0] = t*vt[1];

        
int x round(DotProduct(xCof,vt));
        
int y round(DotProduct(yCof,vt));


        if(
t==0)
            {
            
MoveToEx(hdc,x,y,NULL);
            
SetPixel(hdcxycolor);
            }
        else 
LineTo(hdc,x,y);
    }
    
DeleteObject(p);
 




Post a reply
  Related Posts  to : Draw Hermite Curve
 Draw curves using Hermite Curve equations with mouse clicks     -  
 Draw Bezier Curve and selecting the points with mouse click     -  
 draw 2d curve with showing x axis and y axis     -  
 Curve XY 2D     -  
 text like a curve     -  
 Curve Control Point in java     -  
 How to draw a gun     -  
 Draw An Arc in java     -  
 Draw pie chart php     -  
 Draw rectangle on image     -  

Topic Tags

C++ Graphics