# Curve Drawing Problem

**URL:** <https://forum.kirupa.com/t/curve-drawing-problem/327220>\
**Category:** flash\
**Created:** [February 13, 2012, 7:34pm UTC](https://forum.kirupa.com/t/curve-drawing-problem/327220 "2012-02-13T19:34:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rimacy](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@rimacy](https://forum.kirupa.com/u/rimacy)\
**Post date:** [February 13, 2012, 7:34pm UTC](https://forum.kirupa.com/t/curve-drawing-problem/327220/1 "2012-02-13T19:34:55Z")

</div>

I’m trying to draw a curve that represents the projected trajectory of the ship at current conditionshere’s my code:

function trajectoryMapping():void  
{  
var newX:Number; var oldX:Number;  
var newY:Number;  
var oldY:Number;  
var trajectoryArray:Array = new Array;  
var trajectoryPoint:TrajectoryPoint;  
var trajYVel:Number = \_model.yVel;  
var trajXVel:Number = \_model.xVel;  
var trajGravity:Number = \_model.gravity;

```
   trajCurve.graphics.clear(); //clear curve for redraw
trajCurve.graphics.lineStyle(2, 0x876CD0);
trajCurve.graphics.moveTo(-40, -30);//this should start the line at the ship

    oldX = 220;//starting x & y
oldY = 190;

   trajCurve.graphics.moveTo(trajectoryArray[1].xPoint, trajectoryArray[1].yPoint);

```

if (\_model.xVel == 0 && \_model.yVel == 0)  
{  
[//trajCurve.graphics.lineTo](https://trajCurve.graphics.lineTo)( -40, -30);  
}  
else  
{  
[//line.graphics.lineTo](https://line.graphics.lineTo)(( -40 + (\_model.xVel \* magnitude)), ( -30 + (\_model.yVel \* magnitude)));

trajCurve.graphics.curveTo(trajectoryArray[15].xPoint, trajectoryArray[15].yPoint,trajectoryArray[30].xPoint, trajectoryArray[30].yPoint);

[//GraphicsUtil.drawArrow](https://GraphicsUtil.drawArrow)(trajCurve.graphics,new Point(-40,-30),new Point(( -40 + (\_model.xVel \* magnitude)),( -30 + (\_model.yVel \* magnitude))), style );  
}  
[//trajCurve.x](https://trajCurve.x) = -40;  
[//trajCurve.y](https://trajCurve.y) = -30;

addChild(trajCurve);

}  
(Sorry code block wasn’t working???)

and below is my result. The straight purple line is supposed to be my curve.
