-- $Date: 2004/02/02 09:01:43 $
-- $Revision: 1.11 $
-- $Author: jcrocholl $

with Real_Numbers; use Real_Numbers;
with Real_Vectors; use Real_Vectors;
with Lines; use Lines;

-- Straight lines.
package Straights is

   -- Straight line.
   type Straight is new Line with null record;

   -- Access type for straight lines.
   type Straight_Access is access all Straight;

   -- Create a straight line.
   function Create
     (To : in Vector)    -- End point of the line.
     return Line_Access-- The newly created straight line.

   -- Calculate the length of this line. Results are cached for
   -- reuse. So make sure the starting point always remain the same
   -- between calls.
   function Length
     (Start : in Vector;       -- Starting point of the line.
      This  : access Straight-- Get this line's length.
     return Real;              -- The distance from start to end point.

   -- Scale a line by a given factor.
   procedure Scale
     (This   : access Straight;
      Factor : in Real);

   -- Translate a line by a given offset.
   procedure Translate
     (This   : access Straight-- Translate this line.
      Offset : in Vector);      -- Translating offset.

   -- Get one point from a straight line.
   function Way_Point
     (Start : in Vector;       -- Starting point of the line.
      This  : access Straight-- Definition of the line.
      Part  : in Real)         -- Parametrization variable from 0 to 1.
     return Vector;            -- The point on the line.

   -- Format a straight line for Scalable Vector Graphics output.
   function To_SVG
     (This      : access Straight-- Format this line.
      Tolerance : in Real)         -- Tolerance level.
     return String;                -- The resulting SVG code.

   -- Format a straight line for postscript output.
   function To_Postscript
     (This      : access Straight-- Format this line.
      Tolerance : in Real)         -- Tolerance level.
     return String;                -- The resulting Postscript code.

end Straights;