Exemple #1
0
struct segment *
t1_Snap(struct segment *p)   /* path to snap                                 */
{
       struct fractpoint pt; /* for finding length of path                   */
 
       if (p == NULL)
               return(NULL);
       p = UniquePath(p);
 
       PathDelta(p, &pt);
       if (p->last->type == MOVETYPE) {
               p->last->dest.x -= pt.x;
               p->last->dest.y -= pt.y;
       }
       else
               p = JoinSegment(p, MOVETYPE, -pt.x, -pt.y, NULL);
       return(p);
}
Exemple #2
0
Fichier : paths.c Projet : aosm/X11
/*
:h3.SubLoc() - Vector Subtraction of Two Locition Objects
 
This user operator subtracts two location objects, yielding a new
location object that is the result.
 
The symmetrical function AddLoc() is totally redundent with Join(),
so it is not provided.
*/
 
struct segment *
SubLoc(struct segment *p1, struct segment *p2)
{
       ARGCHECK(!ISLOCATION(p1), "SubLoc: bad first arg", p1, NULL, (0), struct segment *);
       ARGCHECK(!ISLOCATION(p2), "SubLoc: bad second arg", p2, NULL, (0), struct segment *);
       p1 = UniquePath(p1);
       p1->dest.x -= p2->dest.x;
       p1->dest.y -= p2->dest.y;
       ConsumePath(p2);
       return(p1);
}
 
/*
:h2.Straight Line Segments
 
:h3.PathSegment() - Create a Generic Path Segment
 
Many routines need a LINETYPE or MOVETYPE path segment, but do not
want to go through the external user's interface, because, for example,
they already know the "fractpel" destination of the segment and the
conversion is unnecessary.  PathSegment() is an internal routine