ROT_A_TRNSL
Syntax
ROT_A_TRNSL( x0, y0, x, y );
- Input arguments
-
float x0, y0, x, y
Return Values
- Success:
-
int 0
- Failure:
-
int -1 Script interface error.
Description
This function rotates and translates a point. Rotation angle must be set with SET_ROT_ANGLE prior to calling ROT_A_TRNSL.
Example
The following example shows how to define a polyline segment which contains a simple arrowhead in the middle of the segment. The arrowhead orients itself according to the end points of the segment. Short segments are drawn without the arrowhead. This symbol is used in P&ID for visualizing connection lines with flow direction.
Copy
line_w_flowarrw( x1, y1, dx, dy, len, raster )
{
POLY(x1,y1, x1 + dx*len, y1 + dy*len);
/* minimum to show the "arrow" is 6*raster */
if( len < 6*raster )return(0);
SET_ROT_VARS(dx,dy); /* CosA , SinA; we assign directly these to avoid overhead */
p1x = -2 * raster;
p1y = raster;
p2x = 0.0;
p2y = 0.0;
p3x = -2 * raster;
p3y = -raster;
x = x1+ dx * (len /2. + raster);
y = y1 + dy * (len /2. + raster);
ROT_A_TRNSL(x,y, p1x, p1y);
ROT_A_TRNSL(x,y, p2x, p2y);
ROT_A_TRNSL(x,y, p3x, p3y);
POLY(p1x, p1y, p2x, p2y, p3x, p3y);
}
Function Set
Related Functions