

This never holds for skew lines.Ī line m and a plane q in three-dimensional space, the line not lying in that plane, are parallel if and only if they do not intersect.Įquivalently, they are parallel if and only if the distance from a point P on line m to the nearest point in plane q is independent of the location of P on line m. Two distinct lines l and m in three-dimensional space are parallel if and only if the distance from a point P on line m to the nearest point on line l is independent of the location of P on line m. Only if they are in a common plane are they called parallel otherwise they are called skew lines. Two lines in the same three-dimensional space that do not intersect need not be parallel. The parallel symbol is ∥ Two lines in three-dimensional space 2.2 Two lines in three-dimensional space.2.1.4 Distance between two parallel lines.Obviously there's a few variables you will have to replace / substitute for your own (like the mouse locations and the separation value for your line gap), but this should do the trick. Trace(topStart, topEnd, bottomStart, bottomEnd) Var bottomEnd:Point = new Point(endPoint.x + bottomOffsetX, endPoint.y + bottomOffsetY) Var bottomStart:Point = new Point(startPoint.x + bottomOffsetX, startPoint.y + bottomOffsetY) Var topEnd:Point = new Point(endPoint.x + topOffsetX, endPoint.y + topOffsetY) Var topStart:Point = new Point(startPoint.x + topOffsetX, startPoint.y + topOffsetY) Var bottomOffsetY:Number = Math.sin( angle ) * lineHalfGap Var bottomOffsetX:Number = s( angle ) * lineHalfGap Var topOffsetY:Number = Math.sin( angle ) * lineHalfGap

Var topOffsetX:Number = s( angle ) * lineHalfGap Var mouseAngle:Number = Math.atan2( endPoint.y - startPoint.y, endPoint.x - startPoint.x ) Var endPoint:Point = new Point(20, 0) //Replace by end-mouse location This is a whole solution that I quickly tested, I apologize if it doesn't work 100%: var startPoint:Point = new Point(10, 0) //Replace by start-mouse location -90 / radians gives us the number to offset from our START and END point to solve the bottom line.90 / radians gives us a number to offset from our START and END point to solve the top line.If we continue with Radians, it is important to convert our 90 degrees to Radians.

It would be useful to store the above value (180/Math.PI) in a variable. This won't be really necessary however, as we can resume the rest of the calculations in radians. The returned value is in radians I believe, so to work with degrees, you can do the conversion by multiplying the result with 180 / Math.PI. Then, put those deltas in Math.atan2(y:Number, x:Number):Number. So X2 - X1 = DeltaX, and Y2 - Y1 = DeltaY. To know what is the current angle formed by your START and END point, you need the deltas (difference between two values) of your point's X and Y values. Once you determine those 6 points (2 for the top-line, 2 for the mouse start and end, and 2 for the bottom-line), you can join the pair of points for the top-line and bottom-line together with a lineTo(.) command to give you this:. START- ENDĩ0 degrees (DOWN from the START point) 90 degrees (DOWN from the END point) You will need to plot the points this way: 90 degrees (UP from the START point) 90 degrees (UP from the END point) They don't stay parallel to each other or the rotation doesn't work properly. This worked perfectly for drawing a single line, but I'm having troubles with 2 parallel lines. Stop listening for events and add the double line to the stage. start to listen for Mouse Move.Ĭlear the graphics object, draw the double line from the original mouse position to the current mouse position. Like the line tool in Photoshop/Illustrator, but it draws 2 lines at once.Ĭreate a new graphics object and register the X and Y where the user clicked. I need to draw 2 parallel lines between any 2 points on the stage. I would like to be able to define the distance between those 2 lines in a variable. However now i need to develop a tool where the user can draw a double parallel line. I made different tools like in Photoshop (line tool, rectangle tool. I am developping a web application, basically its a simple version of Illustrator/Flash.
