Library for drawing turtle type (Logo turtle)

User projects written in or related to FreeBASIC.
lrcvs
Posts: 555
Joined: Mar 06, 2008 19:27
Location: Spain

New Version: >>> Turtle7.bi Part-2

Postby lrcvs » Nov 08, 2013 19:45

"Part-2" has been modified on 10.11.13. completely.

(The subroutine "Sub Manipulator", not working well, now this right!)

Please notify any problems or mistake!


Here Part-2

Code: Select all

'INIT SUBS AND FUNCTION SHAPES ***********************************************
 
'INIT T_INIT
SUB T_INIT () 'INIT TURTLE
'PARAMETERS COMMONS
SCREENINFO T_W , T_H
WINDOW (0,0)-(T_W,T_H)
T_CENTER_SCREEN_X = INT (T_W / 2)
T_CENTER_SCREEN_Y = INT (T_H / 2)
T_POSITION_X = T_CENTER_SCREEN_X
T_POSITION_Y = T_CENTER_SCREEN_Y
T_GT (T_POSITION_X , T_POSITION_Y)
T_HEADING = 0
T_ORIENT 0
T_PEN = 1
T_SHAPES = 1'ENABLES OR DISABLES THE SHAPES , VALUES 0 / 1
T_THICKNESS = 0 'THICKNESS OF LINES, ARCS, CIRCLES... , VALUES 0...
T_BOLD = 0 'ENABLES OR DISABLES THE BOLD TEXT , VALUES 0 / 1
T_HOLE = 0 'ENABLE OR DISABLE THE HOLE TEXT , VALUES 0 / 1
T_COLOR = 12 'COLOR LINES, ARCS, CIRCLES, ELLIPSES... VALUES 0 ..
T_HOLE_COLOR = 14 'COLORED HOLE CHARS VALUES 0 ..
T_GROSS = 2 'GROSOR INTERIOR TEXTO , VALUES 1...4
T_SCALE = 1 ' SCALE SHAPES, TEXT, NUMBERS...
TX_INIT
END SUB
'END T_INIT

'INIT T_GRID_T
SUB T_GRID (BYVAL T_STEP_GRID AS DOUBLE, T_GRID_OPTION AS INTEGER) 'DRAW A GRIDS
'T_GRID_OPTION = 1 DRAW THE GRID OF TURTLE WOLD
'T_GRID_OPTION = 2 DRAW THE GRID OF SCREEN COORDINATES
'T_GRID_OPTION = 3 DRAW THE GRID OF RADIUS AN ANGLES

DIM AS INTEGER T_N , GT_SHAPES , GT_HOLE , GT_COLOR , GT_PEN , GT_HOLE_COLOR , GT_BOLD
DIM AS DOUBLE GT_SCALE , GT_THICKNESS , GT_POSITION_X , GT_POSITION_Y

DIM AS INTEGER GTX_KEY , GTX_HOLE , GTX_COLOR , GTX_PEN , GTX_HOLE_COLOR , GTX_BOLD
DIM AS INTEGER TX_AI, TX_AF
DIM AS DOUBLE GTX_SCALE , GTX_THICKNESS , GTX_POSITION_X , GTX_POSITION_Y , GTX_SEPARATION , GTX_ROTATE
DIM AS DOUBLE TX_CONT

IF T_GRID_OPTION = 3 THEN TX_AI = 0 : TX_AF = 360 : TX_CONT = 360 : END IF
IF T_GRID_OPTION = 4 THEN TX_AI = -90 : TX_AF = 270 :  TX_CONT = 0 : END IF

GT_SHAPES = T_SHAPES
GT_SCALE = T_SCALE
GT_BOLD = T_BOLD
GT_HOLE = T_HOLE
GT_COLOR = T_COLOR
GT_HOLE_COLOR = T_HOLE_COLOR
GT_THICKNESS = T_THICKNESS
GT_PEN = T_PEN
GT_POSITION_X = T_POSITION_X
GT_POSITION_Y = T_POSITION_Y

GTX_KEY = TX_KEY 
GTX_SCALE = TX_SCALE
GTX_BOLD = TX_BOLD
GTX_HOLE = TX_HOLE
GTX_COLOR = TX_COLOR
GTX_HOLE_COLOR = TX_HOLE_COLOR
GTX_THICKNESS = TX_THICKNESS
GTX_PEN = TX_PEN
GTX_POSITION_X = TX_POSITION_X
GTX_POSITION_Y = TX_POSITION_Y
GTX_SEPARATION = TX_SEPARATION
GTX_ROTATE = TX_ROTATE

TX_SCALE = 1
TX_KEY = 1
TX_BOLD = 0
TX_HOLE = 0
TX_COLOR = 15
TX_ORIENT 0
TX_ROTATE = 90
TX_SEPARATION = 0

IF T_GRID_OPTION = 1 OR T_GRID_OPTION = 2 THEN
FOR T_N = 0 TO TX_H STEP T_STEP_GRID
LINE(0 , T_N) - (TX_W , T_N) , 8  'LINEAS HORIZONTALES
NEXT T_N

FOR T_N = 0 TO TX_W STEP T_STEP_GRID
LINE(T_N , 0) - (T_N , TX_H) , 8  'LINEAS VERTICALES
NEXT T_N
END IF

IF T_GRID_OPTION = 3 OR T_GRID_OPTION = 4 THEN
FOR T_N = 0 TO TX_H STEP T_STEP_GRID
CIRCLE (TX_W/2, TX_H/2), T_N,8  'DIBUJA CIRCULOS CONCENTRICOS
NEXT T_N

FOR T_N = TX_AI TO TX_AF STEP T_STEP_GRID
'AQUI DIBUJAMOS LOS RADIOS/ANGULOS
TX_ORIENT T_N
TX_POSITION (0/TX_SCALE ,0/TX_SCALE)
TX_COLOR = 8
TX_FD TX_W

'AQUI ESCRIBIMOS LOS ANGULOS
TX_POSITION (0/T_SCALE ,0/T_SCALE)
TX_FD 195
TX_ORIENT 0
TX_THICKNESS = 0
TX_COLOR = 15
TX_TEXT STR(ABS(INT(TX_CONT)))
IF T_GRID_OPTION = 3 THEN TX_CONT = TX_CONT - T_STEP_GRID : END IF
IF T_GRID_OPTION = 4 THEN TX_CONT = TX_CONT - T_STEP_GRID : END IF
NEXT T_N
END IF

IF T_GRID_OPTION = 1 OR T_GRID_OPTION = 2 OR T_GRID_OPTION = 3 THEN
TX_POSITION (0 , 0)
END IF

IF T_GRID_OPTION = 1 THEN
'AXE X+     
FOR T_N = TX_W/2 TO TX_W STEP T_STEP_GRID
TX_POSITION_X = T_N
TX_POSITION_Y = TX_H/2
TX_TEXT STR(INT(T_N-TX_W/2))
NEXT T_N

'AXE X-
FOR T_N = TX_W/2 TO 0  STEP -T_STEP_GRID
TX_POSITION_X = T_N
TX_POSITION_Y = TX_H/2
TX_TEXT STR(INT(T_N-TX_W/2))
NEXT T_N

'AXE Y+
FOR T_N = TX_H/2 TO TX_H STEP T_STEP_GRID
TX_POSITION_X = TX_W/2
TX_POSITION_Y = T_N
TX_TEXT STR(INT(T_N-TX_H/2))
NEXT T_N

'AXE Y-
FOR T_N = TX_H/2 TO 0 STEP -T_STEP_GRID
TX_POSITION_X = TX_W/2
TX_POSITION_Y = T_N
TX_TEXT STR(INT(T_N-TX_H/2))
NEXT T_N

END IF

IF T_GRID_OPTION = 2 THEN
'AXE X   
FOR T_N = 0 TO TX_W STEP T_STEP_GRID
TX_POSITION_X = T_N : TX_POSITION_Y = 0 : TX_TEXT STR(INT(T_N))
TX_POSITION_X = T_N : TX_POSITION_Y = TX_H - T_STEP_GRID + T_STEP_GRID/2  : TX_TEXT STR(INT(T_N))
NEXT T_N

'AXE Y     
FOR T_N = 0 TO TX_H STEP T_STEP_GRID
TX_POSITION_X = 0 : TX_POSITION_Y = T_N : TX_TEXT STR(INT(T_N))
TX_POSITION_X = T_W - T_STEP_GRID  : TX_POSITION_Y = T_N : TX_TEXT STR(INT(T_N))
NEXT T_N
END IF

T_SHAPES = GT_SHAPES
T_SCALE = GT_SCALE
T_BOLD = GT_BOLD
T_HOLE = GT_HOLE
T_COLOR = GT_COLOR
T_HOLE_COLOR = GT_HOLE_COLOR
T_THICKNESS = GT_THICKNESS
T_PEN = GT_PEN
T_POSITION_X = GT_POSITION_X
T_POSITION_Y = GT_POSITION_Y

TX_KEY = GTX_KEY
TX_SCALE = GTX_SCALE
TX_BOLD = GTX_BOLD
TX_HOLE = GTX_HOLE
TX_COLOR = GTX_COLOR
TX_HOLE_COLOR = GTX_HOLE_COLOR
TX_THICKNESS = GTX_THICKNESS
TX_PEN = GTX_PEN
TX_POSITION_X = GTX_POSITION_X
TX_POSITION_Y = GTX_POSITION_Y
TX_ROTATE = GTX_ROTATE

T_POSITION (0 , 0)

END SUB

 
FUNCTION T_RADIANS(BYVAL T_ANGLE AS DOUBLE) AS DOUBLE 'TRANSFORM DEGREES TO RADIANS
RETURN (T_ANGLE * 0.0174532925199433)
END FUNCTION

FUNCTION T_APHOTEME (BYVAL T_R AS DOUBLE , BYVAL T_NSIDE AS INTEGER) AS DOUBLE 'CALCULATE APHOTEME
DIM AS DOUBLE T_RGRAD , T_HIP

T_RGRAD = T_RADIANS(0)
T_X0 = (T_R * COS (T_RGRAD)) + T_POSITION_X
T_Y0 = (T_R * SIN (T_RGRAD)) + T_POSITION_Y
T_RGRAD = T_RADIANS(360 / T_NSIDE)
T_X1 = (T_R * COS (T_RGRAD)) + T_POSITION_X
T_Y1 = (T_R * SIN (T_RGRAD)) + T_POSITION_Y
T_X2 = ABS(T_X0 - T_X1)
T_Y2 = ABS(T_Y0 - T_Y1)
T_HIP = SQR((T_X2^2) + (T_Y2^2))
RETURN SQR((T_R^2) - (T_HIP / 2)^2)
END FUNCTION

SUB T_ORIENT (BYVAL T_ANGLE AS DOUBLE) 'SET ORIENTATION TURTLE
T_HEADING = (T_ANGLE * 0.0174532925199433)
END SUB

#MACRO T_DRAW1 ()
'DRAW SHAPES
IF T_PEN = 1 AND T_THICKNESS = 0 AND T_BOLD = 0 THEN LINE (T_POSITION_X , T_POSITION_Y) - (T_NEW_POSITION_X , T_NEW_POSITION_Y) , T_COLOR : END IF
IF T_PEN = 1 AND T_THICKNESS > 0 AND T_BOLD = 1 THEN T_SEGMENT (T_POSITION_X , T_POSITION_Y , T_NEW_POSITION_X , T_NEW_POSITION_Y) : END IF
T_POSITION_X = T_NEW_POSITION_X
T_POSITION_Y = T_NEW_POSITION_Y
#ENDMACRO

SUB T_GT (BYVAL T_X AS DOUBLE , BYVAL T_Y AS DOUBLE) 'GO TO NEW POSITION X , Y
T_X = T_X * T_SCALE
T_Y = T_Y * T_SCALE
T_NEW_POSITION_X = T_CENTER_SCREEN_X + T_X
T_NEW_POSITION_Y = T_CENTER_SCREEN_Y + T_Y
T_DRAW1 ()
END SUB

SUB T_POSITION (BYVAL T_X AS DOUBLE , BYVAL T_Y AS DOUBLE)
T_PEN = 0
T_GT (T_X , T_Y)
T_PEN = 1
END SUB

SUB T_HOME () 'GO HOME TURTLE
T_PEN = 0
T_POSITION_X = T_W \ 2
T_POSITION_Y = T_H \ 2
T_PEN = 1
END SUB

SUB T_BK (BYVAL T_DISTANCE AS DOUBLE) 'FORWARD X DISTANCE
T_DISTANCE = T_DISTANCE * T_SCALE
T_NEW_POSITION_X = T_POSITION_X + (T_DISTANCE * SIN(T_HEADING))
T_NEW_POSITION_Y = T_POSITION_Y - (T_DISTANCE * COS(T_HEADING))
T_DRAW1 ()
END SUB

SUB T_FD (BYVAL T_DISTANCE AS DOUBLE) 'BACK X DISTANCE
T_DISTANCE = T_DISTANCE * T_SCALE
T_NEW_POSITION_X = T_POSITION_X - ( T_DISTANCE * SIN (T_HEADING))
T_NEW_POSITION_Y = T_POSITION_Y + ( T_DISTANCE * COS (T_HEADING))
T_DRAW1 ()
END SUB

SUB T_LT (BYVAL T_ANGLE AS DOUBLE) 'TURN RIGHT
T_HEADING = T_HEADING + (T_ANGLE * 0.0174532925199433)
END SUB

SUB T_RT (BYVAL T_ANGLE AS DOUBLE) 'TURN LEFT
T_HEADING = T_HEADING - (T_ANGLE * 0.0174532925199433)
END SUB

FUNCTION T_LONG (BYVAL T_X1 AS DOUBLE , BYVAL T_Y1 AS DOUBLE , BYVAL T_X2 AS DOUBLE , BYVAL T_Y2 AS DOUBLE) AS DOUBLE 'CALCULATE DISTANCE / LENGHT TWO POINTS
RETURN SQR(ABS((T_X1 - T_X2)^2) + ABS((T_Y1 - T_Y2)^2))
END FUNCTION

#MACRO T_DRAW2 (T_N , T_HIP , T_ANG , T_LX , T_LY , T_LPX , T_LPY , T_DX , T_DY)
T_LY = SIN(T_ANG) * T_N
T_LX = COS(T_ANG) * T_N
IF T_LX1 < T_LX2 AND T_LY1 < T_LY2 THEN T_LPX = T_LX + T_LX1 : T_LPY = T_LY + T_LY1 : END IF
IF T_LX1 < T_LX2 AND T_LY1 > T_LY2 THEN T_LPX = T_LX + T_LX1 : T_LPY = T_LY1 - T_LY : END IF
IF T_LX1 > T_LX2 AND T_LY1 < T_LY2 THEN T_LPX = T_LX + T_LX2 : T_LPY = T_LY2 - T_LY : END IF
IF T_LX1 > T_LX2 AND T_LY1 > T_LY2 THEN T_LPX = T_LX1 - T_LX : T_LPY = T_LY1 - T_LY : END IF
IF T_LX1 = T_LX2 AND T_LY1 < T_LY2 THEN T_LPX = T_LX + T_LX2 : T_LPY = T_LY2 - T_LY : END IF
IF T_LX1 = T_LX2 AND T_LY1 > T_LY2 THEN T_LPX = T_LX + T_LX2 : T_LPY = T_LY2 + T_LY : END IF
IF T_LX1 < T_LX2 AND T_LY1 = T_LY2 THEN T_LPX = T_LX2 - T_LX : T_LPY = T_LY2 + T_LY : END IF
IF T_LX1 > T_LX2 AND T_LY1 = T_LY2 THEN T_LPX = T_LX2 + T_LX : T_LPY = T_LY2 + T_LY : END IF
IF T_LX1 = T_LX2 AND T_LY1 = T_LY2 THEN T_LPX = T_LX1 : T_LPY = T_LY1 : END IF
#ENDMACRO


SUB T_SEGMENT (BYVAL T_LX1 AS DOUBLE , BYVAL T_LY1 AS DOUBLE , BYVAL T_LX2 AS DOUBLE , BYVAL T_LY2 AS DOUBLE)
DIM AS INTEGER T_N
DIM AS DOUBLE T_HIP , T_ANG , T_LX , T_LY , T_LPX , T_LPY , T_DX , T_DY
T_DX = ABS (T_LX1 - T_LX2)
T_DY = ABS (T_LY1 - T_LY2)
T_HIP = T_LONG (BYVAL T_LX1 , BYVAL T_LY1 , BYVAL T_LX2 , BYVAL T_LY2 )
T_ANG = ATN(T_DY / T_DX)

IF T_BOLD = 1 THEN
FOR T_N = 0 TO T_HIP
T_DRAW2 (T_N , T_HIP , T_ANG , T_LX , T_LY , T_LPX , T_LPY , T_DX , T_DY)
IF T_PEN = 1 AND  T_BOLD = 0  THEN EXIT FOR
IF T_PEN = 1 AND T_THICKNESS > 0 THEN CIRCLE (T_LPX , T_LPY) , T_THICKNESS , T_COLOR , , , , F : END IF
NEXT T_N
END IF

IF T_HOLE = 1 AND T_BOLD = 1 THEN
FOR T_N = 0 TO T_HIP
IF T_PEN = 1 AND  T_BOLD = 0  THEN EXIT FOR   
T_DRAW2 (T_N , T_HIP , T_ANG , T_LX , T_LY , T_LPX , T_LPY , T_DX , T_DY)
IF T_PEN = 1 AND T_THICKNESS > 0 THEN CIRCLE (T_LPX , T_LPY) , T_THICKNESS / T_GROSS , T_HOLE_COLOR , , , , F : END IF
NEXT T_N
END IF
END SUB


'INIT SHAPES / FIGURES ********************************************************

'INIT T_CIRCLE
SUB T_CIRCLE (BYVAL T_R AS DOUBLE)
'DRAW A CIRCLE
'T_R = RADIUS CIRCLE
DIM AS DOUBLE T_GRAD , T_X0 , T_Y0 , T_X1 , T_Y1 , T_X2 , T_Y2 , T_X3 , T_Y3
T_R1 = T_R * T_SCALE
T_X0 = (T_R1 * COS(T_RADIANS (0))) + T_POSITION_X
T_Y0 = (T_R1 * SIN(T_RADIANS (0))) + T_POSITION_Y
T_FIRST_POSITION_X = T_X0
T_FIRST_POSITION_Y = T_Y0
FOR T_GRAD = 0 TO 360
T_X1 = (T_R1 * COS(T_RADIANS (T_GRAD))) + T_POSITION_X
T_Y1 = (T_R1 * SIN(T_RADIANS (T_GRAD))) + T_POSITION_Y
IF T_SHAPES = 1 AND T_PEN = 1 THEN LINE (T_X0 , T_Y0) - (T_X1 , T_Y1) , T_COLOR : END IF
IF T_SHAPES = 1 AND T_PEN = 1 AND T_THICKNESS > 0 AND T_BOLD = 1 THEN CIRCLE (T_X1 , T_Y1) , T_THICKNESS , T_COLOR , , , , F : END IF
T_X0 = T_X1
T_Y0 = T_Y1
T_LAST_POSITION_X = T_X1
T_LAST_POSITION_Y = T_Y1
NEXT T_GRAD
IF T_HOLE = 1 THEN
FOR T_GRAD = 0 TO 360
T_X1 = (T_R1 * COS(T_RADIANS (T_GRAD))) + T_POSITION_X
T_Y1 = (T_R1 * SIN(T_RADIANS (T_GRAD))) + T_POSITION_Y
IF T_SHAPES = 1 AND T_PEN = 1 AND T_THICKNESS > 0 AND T_BOLD = 1 THEN CIRCLE (T_X1 , T_Y1) , T_THICKNESS / T_GROSS , T_HOLE_COLOR , , , , F : END IF
NEXT T_GRAD
END IF
END SUB
'END T_CIRCLE

'INIT T_ARC_SEC_CIR
SUB T_ARC_SEC_CIR (BYVAL T_R1 AS DOUBLE , BYVAL T_INI AS DOUBLE , BYVAL T_END AS DOUBLE , BYVAL T_ANG_ROT AS DOUBLE , BYVAL T_ARC_SEC_CIRCLE AS INTEGER) 'DRAW A ARC CIRCLE
'DRAW A SECTOR CIR
'T_R = RADIUS CIRCLE
'T_INI = ANGLE INIT
'T_END = ANGLE END
'T_ANG_ROT = ANGLE OF ROTATION
'T_ARC_SEC_CIR = 0 = ARC / 1 = SECTOR
DIM AS DOUBLE T_GRAD , T_X0 , T_Y0 , T_X1 , T_Y1 , T_X2 , T_Y2 , T_X3 , T_Y3
T_R1 = T_R1 * T_SCALE
T_X0 = (T_R1 * COS(T_RADIANS (T_INI)))
T_Y0 = (T_R1 * SIN(T_RADIANS (T_INI)))
T_X1 = (T_X0 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y0 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y1 = (T_X0 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y0 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
T_FIRST_POSITION_X = T_X1:T_FIRST_POSITION_Y = T_Y1

FOR T_GRAD = T_INI TO T_END
T_X2 = (T_R1 * COS(T_RADIANS (T_GRAD)))
T_Y2 = (T_R1 * SIN(T_RADIANS (T_GRAD)))
T_X3 = (T_X2 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y2 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y3 = (T_X2 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y2 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
'RADIUS
IF T_ARC_SEC_CIRCLE = 1 AND T_GRAD = T_INI AND T_SHAPES = 1 AND T_PEN = 1 THEN LINE (T_POSITION_X , T_POSITION_Y) - (T_X3 , T_Y3) , T_COLOR
IF T_ARC_SEC_CIRCLE = 1 AND  T_GRAD = T_END AND T_SHAPES = 1 AND T_PEN = 1 THEN LINE (T_POSITION_X , T_POSITION_Y) - (T_X3 , T_Y3) , T_COLOR
IF T_ARC_SEC_CIRCLE = 1 AND  T_GRAD = T_INI AND T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN T_SEGMENT (T_POSITION_X , T_POSITION_Y , T_X3 , T_Y3)
IF T_ARC_SEC_CIRCLE = 1 AND  T_GRAD = T_END AND T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN T_SEGMENT (T_POSITION_X , T_POSITION_Y , T_X3 , T_Y3)
'ARC
IF T_SHAPES = 1 AND T_PEN = 1 THEN LINE (T_X1 , T_Y1) - (T_X3 , T_Y3) , T_COLOR
IF T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN CIRCLE (T_X3 , T_Y3) , T_THICKNESS , T_COLOR , , , , F
T_X1 = T_X3
T_Y1 = T_Y3
T_LAST_POSITION_X = T_X3
T_LAST_POSITION_Y = T_Y3
NEXT T_GRAD
IF T_HOLE = 1 THEN
FOR T_GRAD = T_INI TO T_END
T_X2 = (T_R1 * COS(T_RADIANS (T_GRAD))):T_Y2 = (T_R1 * SIN(T_RADIANS (T_GRAD)))
T_X3 = (T_X2 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y2 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y3 = (T_X2 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y2 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
IF T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN CIRCLE (T_X3 , T_Y3) , T_THICKNESS / T_GROSS , T_HOLE_COLOR , , , , F
NEXT T_GRAD
END IF
END SUB
'END T_ARC_SEC_CIR

'INIT T_ELLIPSE
SUB T_ELLIPSE (BYVAL T_R1 AS DOUBLE , BYVAL T_R2 AS DOUBLE , BYVAL T_ANG_ROT AS DOUBLE)
'DRAW A ELLIPSE WITH ROTATION
'T_R1 = RADIUS BIGGER
'T_R2 = RADIUS SMALLER
'T_ANG_ROT = DEGREES TO ROTATE
DIM AS DOUBLE T_RGRAD , T_GRAD , T_X0 , T_Y0 , T_X1 , T_Y1 , T_X2 , T_Y2 , T_X3 , T_Y3
T_R1 = T_R1 * T_SCALE
T_R2 = T_R2 * T_SCALE
T_RGRAD = T_RADIANS (T_ANG_ROT)
T_X0 = (T_R1 * COS(T_RGRAD))
T_Y0 = (T_R2 * SIN(T_RGRAD))
T_X1 = (T_X0 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y0 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y1 = (T_X0 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y0 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
T_FIRST_POSITION_X = T_X1
T_FIRST_POSITION_Y = T_Y1
FOR T_GRAD = T_ANG_ROT TO T_ANG_ROT + 360
T_X2 = (T_R1 * COS(T_RADIANS (T_GRAD)))
T_Y2 = (T_R2 * SIN(T_RADIANS (T_GRAD)))
T_X3 = (T_X2 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y2 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y3 = (T_X2 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y2 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
IF T_SHAPES = 1 AND T_PEN = 1 THEN LINE (T_X1 , T_Y1) - (T_X3 , T_Y3) , T_COLOR
IF T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN CIRCLE (T_X3 , T_Y3) , T_THICKNESS , T_COLOR , , , , F
T_X1 = T_X3
T_Y1 = T_Y3
T_LAST_POSITION_X = T_X3
T_LAST_POSITION_Y = T_Y3
NEXT T_GRAD
IF T_HOLE = 1 THEN
FOR T_GRAD = T_ANG_ROT TO T_ANG_ROT + 360
T_X2 = (T_R1 * COS(T_RADIANS (T_GRAD)))
T_Y2 = (T_R2 * SIN(T_RADIANS (T_GRAD)))
T_X3 = (T_X2 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y2 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y3 = (T_X2 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y2 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
IF T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN CIRCLE (T_X3 , T_Y3) , T_THICKNESS / T_GROSS , T_HOLE_COLOR , , , , F
NEXT T_GRAD
END IF
END SUB
'END T_ELLIPSE

'INIT T_ARC_SEC_ELLIP
SUB T_ARC_SEC_ELLIP (BYVAL T_R1 AS DOUBLE , BYVAL T_R2 AS DOUBLE , BYVAL T_INI AS DOUBLE , BYVAL T_END AS DOUBLE , BYVAL T_ANG_ROT AS DOUBLE , BYVAL T_ARC_SEC_ELLIPSE AS INTEGER) 'DRAW A ELLIPTIC SECTOR
'DRAW A SECTOR ELLIPTIC
'T_R1 = RADIUS 1
'T_R2 = RADIUS 2
'T_INI = ANGLE INIT
'T_END = ANGLE END
'T_ANG_ROT = ANGLE OF ROTATION
'T_ARC_SEC_ELLIPSE = 0/1 DRAW A SECTOR OR ARC OF ELLIPSE
DIM AS DOUBLE T_GRAD , T_X0 , T_Y0 , T_X1 , T_Y1 , T_X2 , T_Y2 , T_X3 , T_Y3
T_R1 = T_R1 * T_SCALE
T_R2 = T_R2 * T_SCALE
T_X0 = (T_R1 * COS(T_RADIANS (T_INI)))
T_Y0 = (T_R2 * SIN(T_RADIANS (T_INI)))
T_X1 = (T_X0 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y0 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y1 = (T_X0 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y0 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
T_FIRST_POSITION_X = T_X1
T_FIRST_POSITION_Y = T_Y1
IF T_SHAPES = 1 AND T_PEN = 1 THEN LINE (T_POSITION_X , T_POSITION_Y) - (T_X1 , T_Y1) , T_COLOR
IF T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN T_SEGMENT (T_POSITION_X , T_POSITION_Y , T_X1 , T_Y1)
FOR T_GRAD = T_INI TO T_END
T_X2 = (T_R1 * COS(T_RADIANS (T_GRAD)))
T_Y2 = (T_R2 * SIN(T_RADIANS (T_GRAD)))
T_X3 = (T_X2 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y2 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y3 = (T_X2 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y2 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
'RADIUS
IF T_ARC_SEC_ELLIPSE = 1 AND T_GRAD = T_INI AND T_SHAPES = 1 AND T_PEN = 1 THEN LINE (T_POSITION_X , T_POSITION_Y) - (T_X1 , T_Y1) , T_COLOR
IF T_ARC_SEC_ELLIPSE = 1 AND T_GRAD = T_END AND T_SHAPES = 1 AND T_PEN = 1 THEN LINE (T_POSITION_X , T_POSITION_Y) - (T_X3 , T_Y3) , T_COLOR
IF T_ARC_SEC_ELLIPSE = 1 AND T_GRAD = T_INI AND T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN T_SEGMENT (T_POSITION_X , T_POSITION_Y , T_X1 , T_Y1)
IF T_ARC_SEC_ELLIPSE = 1 AND T_GRAD = T_END AND T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN T_SEGMENT (T_POSITION_X , T_POSITION_Y , T_X3 , T_Y3)
'ARC
IF T_SHAPES = 1 AND T_PEN = 1 THEN LINE (T_X1 , T_Y1) - (T_X3 , T_Y3) , T_COLOR
IF T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN CIRCLE(T_X3 , T_Y3) , T_THICKNESS , T_COLOR , , , , F
T_X1 = T_X3
T_Y1 = T_Y3
T_LAST_POSITION_X = T_X3
T_LAST_POSITION_Y = T_Y3
NEXT T_GRAD
IF T_HOLE = 1 THEN
FOR T_GRAD = T_INI TO T_END
T_X2 = (T_R1 * COS(T_RADIANS (T_GRAD)))
T_Y2 = (T_R2 * SIN(T_RADIANS (T_GRAD)))
T_X3 = (T_X2 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y2 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y3 = (T_X2 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y2 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
IF T_SHAPES = 1 AND T_PEN = 1 AND T_BOLD = 1 AND T_THICKNESS > 0 THEN CIRCLE(T_X3 , T_Y3) , T_THICKNESS / T_GROSS , T_HOLE_COLOR , , , , F
NEXT T_GRAD
END IF
END SUB
'END T_ARC_SEC_ELLIP

'INIT T_POLY
SUB T_POLY (BYVAL T_R AS DOUBLE , BYVAL T_NSIDE AS INTEGER , BYVAL T_ANG_ROT AS INTEGER)
'DRAW AND ROTATE A POLYGON
'T_R = RADIUS POLYGON
'T_NSIDE = NUMBER OF SIDES
'T_ANG_ROT = DEGREES OF ROTATION
DIM AS DOUBLE T_GRAD , T_X3 , T_Y3
T_R = T_R * T_SCALE
T_X0 = (T_R * COS (T_RADIANS (T_ANG_ROT)))
T_Y0 = (T_R * SIN (T_RADIANS (T_ANG_ROT)))
T_X1 = (T_X0 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y0 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y1 = (T_X0 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y0 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
T_FIRST_POSITION_X = T_X1
T_FIRST_POSITION_Y = T_Y1
IF T_BOLD = 0 THEN T_THICKNESS = 0
FOR T_GRAD = T_ANG_ROT TO T_ANG_ROT + 360 STEP 360 / T_NSIDE
T_X2 = (T_R * COS (T_RADIANS (T_GRAD)))
T_Y2 = (T_R * SIN (T_RADIANS (T_GRAD)))
T_X3 = (T_X2 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y2 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y3 = (T_X2 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y2 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
IF T_SHAPES = 1 AND T_PEN = 1 AND T_THICKNESS = 0 AND T_BOLD = 0 THEN LINE (T_X1 , T_Y1) - (T_X3 , T_Y3) , T_COLOR
IF T_SHAPES = 1 AND T_PEN = 1 AND T_THICKNESS > 0 AND T_BOLD = 1 THEN T_SEGMENT (T_X1 , T_Y1 , T_X3 , T_Y3)
T_X1 = T_X3
T_Y1 = T_Y3
T_LAST_POSITION_X = T_X3
T_LAST_POSITION_Y = T_Y3
NEXT T_GRAD
END SUB
'END T_POLY

'INIT T_STAR
SUB T_STAR (BYVAL T_NP AS INTEGER , BYVAL T_RG AS DOUBLE , BYVAL T_RP AS DOUBLE , BYVAL T_ANG_ROT AS DOUBLE)
DIM AS INTEGER C
DIM AS DOUBLE NP , N , R, T_X0 , T_Y0 , T_X1 , T_Y1 , T_X2 , T_Y2 , T_X3 , T_Y3
IF T_NP = 0 THEN T_NP = 1 : END IF
T_NP = ABS(T_NP)
NP = (180 / T_NP)
C = 0
R = T_RG * T_SCALE
T_X0 = (T_R * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y0 = (T_R * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
T_X1 = (T_X0 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y0 * SIN (T_RADIANS (T_ANG_ROT))) '+ T_POSITION_X
T_Y1 = (T_X0 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y0 * COS (T_RADIANS (T_ANG_ROT))) '+ T_POSITION_Y
T_FIRST_POSITION_X = T_X1
T_FIRST_POSITION_Y = T_Y1
FOR N = T_ANG_ROT TO (T_ANG_ROT + 360 + NP) STEP NP
IF C MOD 2 = 0 THEN
R = T_RG * T_SCALE
ELSE
R = T_RP * T_SCALE
END IF
T_X2 = (COS(T_RADIANS(N)) * R )
T_Y2 = (SIN(T_RADIANS(N)) * R )
T_X3 = (T_X2 * COS (T_RADIANS (T_ANG_ROT))) - (T_Y2 * SIN (T_RADIANS (T_ANG_ROT))) + T_POSITION_X
T_Y3 = (T_X2 * SIN (T_RADIANS (T_ANG_ROT))) + (T_Y2 * COS (T_RADIANS (T_ANG_ROT))) + T_POSITION_Y
IF T_SHAPES = 1 AND T_PEN = 1 AND C > 0  THEN LINE (T_X0 , T_Y0) - (T_X3 , T_Y3) , T_COLOR
IF T_SHAPES = 1 AND T_PEN = 1 AND C > 0 AND T_THICKNESS > 0 AND T_BOLD = 1 THEN T_SEGMENT (T_X0 , T_Y0 , T_X3 , T_Y3)
C = C + 1
T_X0 = T_X3
T_Y0 = T_Y3
NEXT N
T_LAST_POSITION_X = T_X3
T_LAST_POSITION_Y = T_Y3
END SUB
'END T_STAR

'INIT OVOID
SUB T_OVOID (BYVAL T_R1 AS DOUBLE , BYVAL T_R2 AS DOUBLE , BYVAL T_ANG_ROT AS DOUBLE) 'DRAW A OVOID
'DRAW A OVOID
'T_R1 = RADIUS 1 (SMALLER)
'T_R2 = RADIUS 2 (BIGGER)
'T_ANG_ROT = ANGLE OF ROTATION
T_ARC_SEC_ELLIP (T_R1 , T_R2 , 0 , 180 , T_ANG_ROT,0)
T_ARC_SEC_CIR (T_R1 , 180 , 360 , T_ANG_ROT,0)
END SUB
'END OVOID

'INIT T_SPRING
SUB T_SPRING (T_NS AS INTEGER , T_RS AS DOUBLE , T_LO AS DOUBLE) 'DRAW A T_SPRING
DIM T_N AS INTEGER
'T_NS = NUMBER OF SPIRALS
'T_RS = STRETCH OF SPIRAL 0...90
'T_LO = LONG OF SPIRAL
FOR T_N = 1 TO T_NS
T_RT T_RS
T_FD T_LO
T_LT T_RS * 2
T_FD T_LO
T_RT T_RS
NEXT T_N
END SUB
'END SPRING

'INIT T_CILINDER
SUB T_CILINDER ( T_CA AS DOUBLE, T_CR AS DOUBLE, T_CD AS DOUBLE, T_CL AS DOUBLE, T_CP AS DOUBLE, T_CS AS DOUBLE) 'DRAW A PNEUMATIC CILINDER
'DRAW A PNEUMATIC / HIDRAULIC CILINDER
'T_CA ANGLE POSITION CILINDER
'T_CR RADIUS ROTATION
'T_CD DIAMETER CILINDER
'T_CL LONG CILINDER
'T_CP POSITION PISTON
'T_CS SUPLEMENTARY PISTON
T_ORIENT T_CA
T_PEN = 0
T_FD T_CR 'ROTATION RADIUS
T_BK T_CR
T_PEN = 1
T_CIRCLE T_CD /8 'SHOW ROTATION POINT
T_PEN = 0
T_FD T_CR
T_PEN = 1
T_RT 90
T_FD T_CD / 2
T_RT 90
T_FD T_CL
T_RT 90
T_FD T_CD
T_RT 90
T_FD T_CL
T_RT 90
T_FD T_CD / 2
'VASTAGO / PISTON
T_LT 180
T_FD T_CD /8
T_RT 90
IF T_CP > T_CL THEN T_CP = T_CL
IF T_CP < 0 THEN T_CP = 0
T_FD ABS (T_CP)+ T_CS 'SALIDA DEL VASTAGO + ADICIONAL
T_RT 90
T_FD T_CD /8 'CENTER PISTON
T_FD T_CD /8 'CENTER PISTON
T_RT 90
T_FD ABS (T_CP) + T_CS 'SALIDA DEL VASTAGO + ADICIONAL
T_RT 90
T_FD T_CD /8
T_PEN = 0
T_RT 90
T_FD ABS (T_CP) + T_CS
T_PEN = 1
END SUB
'END T_CILINDER

'INIT T_MANIPULATOR
SUB T_MANIPULATOR (T_MLA AS DOUBLE , T_MLP AS DOUBLE , T_MP AS DOUBLE , T_MROT AS DOUBLE, T_MLC AS DOUBLE)
'DRAW MANIPULATOR
'T_MLA LONG TOTAL APERTURE
'T_MLP LONG TOTAL PINCERS
'T_MP POSITION PINCERS
'T_MROT POSITION ANGLE ROTATION
'T_MLC CONTACT POINT PINCERS
T_ORIENT T_MROT
T_PEN = 1
T_MLA = T_MLA * 2
IF T_MP > = (T_MLA / 2) THEN T_MP = (T_MLA / 2)
'AQUI CREAMOS EL CUERPO DEL MANIPULADOR
T_RT 90 : T_FD (T_MLA / 2) + 10
T_RT 90 : T_FD T_MLA / 2
T_RT 90 : T_FD T_MLA + 20
T_RT 90 : T_FD T_MLA / 2
T_RT 90 : T_FD (T_MLA / 2) + 10

'AQUI CREAMOS LA PARTE GIRATORIA
T_ARC_SEC_CIR ((T_MLA / 2) + 10 , 0 , 180 , T_MROT,0)

'AQUI CREAMOS EL PUNTO DE ROTACION
T_CIRCLE (5)

T_PEN = 0
'AQUI CREAMOS Y POSICIONAMOS LAS PINZAS
T_RT 90
T_FD (T_MLA / 2)
T_LT 90
T_FD T_MP 'POSICION INICIAL "0" PINZAS
'INICIO PINZA DERECHA
T_LT 90
T_PEN = 1
T_ARC_SEC_ELLIP (10 , T_MLP , 270 , 360 , T_MROT,0)
'FIN PINZA DERECHA
'ESTO ES LA POSICION DE APERTURA CIERRE DE LAS PINZAS
T_PEN = 1
T_RT 90
T_BK 10
T_BK ((T_MP ) * 2) - 10
'INICIO PINZA IZQUIERDA
T_RT 90
T_PEN = 1
T_ARC_SEC_ELLIP (10 , T_MLP , 180 , 270 , T_MROT, 0)
T_FD T_MLP
T_BK T_MLP
'FIN PINZA IZQUIERDA
'PUNTO DE CONTACTO
T_PEN = 0
T_RT 270
T_FD (T_MP)
T_RT 90
IF T_MLC >= T_MLP THEN T_MLC = T_MLP
IF T_MLC <= 0 THEN T_MLC = 0
T_FD T_MLC 'PUNTO DE CONTACTO DE LAS PINZAS
T_PEN = 1
END SUB
'END MANIPULATOR

'END SHAPES *******************************************************************


Last edited by lrcvs on Nov 10, 2013 5:26, edited 1 time in total.
lrcvs
Posts: 555
Joined: Mar 06, 2008 19:27
Location: Spain

Test >>> Turtle7.bi

Postby lrcvs » Nov 08, 2013 19:53

Here Tutle7.bi :

Part_1: viewtopic.php?f=8&t=21368&p=192237#p192237

Part_2: viewtopic.php?f=8&t=21368&start=45#p192238


"Little" Test Turtle7.bi

Code: Select all

#INCLUDE "TURTLE7.BI"

DIM N AS INTEGER

CLS
SCREEN 12
T_INIT
FOR N= 1 TO 4
     CLS
     T_GRID (20,N)
     SLEEP
NEXT N
END



Regards
frisian
Posts: 231
Joined: Oct 08, 2009 17:25

Re: Library for drawing turtle type (Logo turtle)

Postby frisian » Nov 10, 2013 15:58

lrcvs

I have not looked at your new version in detail but my eyes spotted some thing i mentioned earlier to

frisian wrote:DIM AS INTEGER TX_LONGTEXT , TX_N , tx_char0, TX_CHAR1 , TX_CHAR2
TX_LONGTEXT = LEN(TX_STRING)
TX_THICKNESS = TX_THICKNESS <== Think
tx_scale = tx_scale <== Think
TX_CHAR1 = 0 <== When you DIM a variable FB set it to 0 ("zero")
TX_CHAR2 = 0 <== When you DIM a variable FB set it to 0 ("zero")

you should take some time to clean up your code, these sort of errors are easy to spot and to correct.
lrcvs
Posts: 555
Joined: Mar 06, 2008 19:27
Location: Spain

Re: Library for drawing turtle type (Logo turtle)

Postby lrcvs » Nov 10, 2013 21:44

Hi, frisian:

You're absolutely right, those are mistakes "dumb".!

Since the purge for a future release.!

How is your version?

I guess more perfect than mine, I hope to see you soon.

regards

Note:

I made a new figure: The telescopic cylinder.

The future release will put in, hopefully interesting.!
lrcvs
Posts: 555
Joined: Mar 06, 2008 19:27
Location: Spain

Telescopic Cilinder

Postby lrcvs » Nov 11, 2013 19:29

Telescopic Cilinder

Code: Select all

SUB T_TELESCOPIC_CILINDER (T_DIAM_CIL AS DOUBLE, T_LONG_TOTAL AS DOUBLE, T_STEPS AS DOUBLE, T_POSITION_STEP AS DOUBLE, T_ROT_CIL AS DOUBLE, T_RADIUS_ROT AS DOUBLE)

DIM T_TOT_STEPS AS INTEGER

DIM AS DOUBLE T_LONG_STEP , T_RING , T_NTC

'T_DIAM_CIL = DIAMETER OF CILINDER
'T_LONG_TOTAL = LONG TOTAL
'T_STEPS = NUMBER OD STEPS
'T_POSITION = POSITION EXTREME CILINDER
'T_ROT_CIL = ANGLE OF ROTATION OF CILINDER
'T_RADIUS_ROT = POINT RADIUS ROTATION

T_POSITION (220,140):T_COLOR = 12
T_TOT_STEPS = T_STEPS + 1
T_RING = (T_DIAM_CIL/2) / (T_STEPS)
T_LONG_STEP = T_LONG_TOTAL / T_STEPS
IF T_POSITION_STEP > T_LONG_STEP THEN T_POSITION_STEP = T_LONG_STEP : END IF
IF T_RADIUS_ROT > T_LONG_STEP THEN T_RADIUS_ROT = T_LONG_STEP : END IF
T_ORIENT T_ROT_CIL

'INIT PART RADIUS ROTATION
T_CIRCLE 5
T_PEN = 0
T_FD T_RADIUS_ROT  * (-1)
T_PEN = 1

'INIT_PART
T_RT 90
T_FD (T_RING * T_STEPS)
T_LT 90
T_FD T_LONG_STEP
T_LT 90
T_FD (T_RING * T_STEPS)*2
T_LT 90
T_FD T_LONG_STEP
T_LT 90
T_FD (T_RING * T_STEPS)
T_PEN =0
T_LT 90
T_FD T_LONG_STEP
T_PEN = 1

'STEPS PARTS
FOR T_NTC = 1 TO T_STEPS - 1
T_RT 90
T_FD (T_RING * ((T_STEPS - T_NTC) ))
T_LT 90
T_FD T_POSITION_STEP
T_LT 90
T_FD (T_RING * ((T_STEPS - T_NTC) ))*2
T_LT 90
T_FD T_POSITION_STEP
T_LT 90
T_FD (T_RING * ((T_STEPS - T_NTC)))
T_PEN =0
T_LT 90
T_FD T_POSITION_STEP
T_PEN = 1
NEXT T_NTC
END SUB
frisian
Posts: 231
Joined: Oct 08, 2009 17:25

Re: Library for drawing turtle type (Logo turtle)

Postby frisian » Nov 17, 2013 16:44

@Lrcvs
Here is my version of your turtle#.bi file. The basic is your version #5 with some additions you made. I have replaced the T_SEGMENT routine with a version that uses the Bresenham line algorithm. Since I have changed some things regarding coordinates and angles it is not compatible with programs that you wrote. I have changes some of your programs so that they will work under my version. I also dropped t_shapes and t_text_key, when accessing T_TEXT the colors are changed into the text colors. On leaving T_TEXT the original colors are restored. T_READ_KEYS still need some work done to it.
All the work on TESTUDO is done with a few things in mind.
Reduce file size and try to avoid calculations that can be replaced by a simple variable.

File size reduction was found in letting t_sec_cir handle also t_arc_cir and letting t_sec_ellip handing also t_arc_ellip. Some identical code in t_let, t_num and t_sym was moved to t_text.
Simplifying the calculation of the point in the both _cir, t_star and t_poly routines mend speed gain and file size reduction. In the both routines for ellipses Sin(t_radians (t_ang_rot)) and Cos(t_radians (t_ang_rot)) are used for calculating the position of the point, since t_ang_rot stays the same the outcome of Sin(t_radians (t_ang_rot)) and Cos(t_radians (t_ang_rot)) stays the same. Replacing them in rest of the routine by a variable give a speed up. (If the name of that variable is made shorter, a reduction if file size is possible).


Here is my version, save it as “TESTUDO1.BI”, filesize about 45300 bytes.
[code file=TESTUDO1.BI]' testudo version 1 based on lrcvs freebasic_turtle version #5
' plus some extra things.
' cleaned up code and incorporated t_arc_cir into t_sec_cir and t_arc_ellip into t_sec_ellip
' replace original t_segment with a new routine based on a Bresenham line algorithm
' added t_oviod, t_spring, t_cilinder, t_manipulator and t_telescopic_cilinder
' does not use t_shapes and t_text_key, everything is considered a shape.
' for text shapes the text colors are used

Const pi = 4 * Atn(1)
Const dtor = Atn(1) / 45 'constante de conversion entre degrees (grados) y radianes

Dim Shared As Integer t_n,t_r,t_center_screen_x, t_center_screen_y, t_w, t_h, t_pen, t_color, t_hole_color, t_bold, t_text_bold
Dim Shared As Integer t_hole,t_text_hole, t_text_hole_color, t_text_color, t_text_gross, t_gross,t_text_hole_key
Dim Shared As Double t_position_x, t_position_y, t_angle, t_step_grid, t_heading, t_rottext,t_star_x,t_star_y
Dim Shared As Double t_new_position_x, t_new_position_y, t_x, t_y, t_distance, t_scale, t_thickness
Dim Shared As Double t_first_position_x, t_first_position_y, t_last_position_x, t_last_position_y
Dim Shared As Double t_x0, t_y0, t_x1, t_y1, t_x2, t_y2, t_r1, t_r2, t_cp, t_ini, t_end, t_text_thickness

Dim Shared As Double t_margin, t_separation 't_separation = separation of the chars

'::::::::::::::::::::::::::::::::::::::::::::::::subroutines and functions

'::::::::::::::::::::::::::::::::::::::::::::::::init t_radians
#Macro t_radians (x)
(x) * dtor
#EndMacro
'::::::::::::::::::::::::::::::::::::::::::::::::end t_radians

'::::::::::::::::::::::::::::::::::::::::::::::::init t_orient
Sub t_orient (ByVal t_angle As Double)'set orientation turtle
t_heading = t_angle * dtor
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_orient

'::::::::::::::::::::::::::::::::::::::::::::::::init t_rt
Sub t_rt (ByVal t_angle As Double)'turn right
t_heading = t_heading - t_angle * dtor
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_rt

'::::::::::::::::::::::::::::::::::::::::::::::::init t_lt
Sub t_lt (ByVal t_angle As Double)'turn left
t_heading = t_heading + t_angle * dtor
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_lt

'::::::::::::::::::::::::::::::::::::::::::::::::init t_point
Sub t_point
'draw a point
If t_pen = 1 Then PSet (t_position_x, t_position_y),t_color
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_point

'note : t_long = hypotenuse

'::::::::::::::::::::::::::::::::::::::::::::::::init t_long
Function t_long (ByVal t_x1 As Double, ByVal t_y1 As Double, ByVal t_x2 As Double, ByVal t_y2 As Double) As Double ' calculate distance /lenght two points
Dim As Double dx = t_x1 - t_x2
Dim As Double dy = t_y1 - t_y2
Return Sqr(dx*dx + dy*dy)
End Function
'::::::::::::::::::::::::::::::::::::::::::::::::end t_long

':::::::::::::::::::::::::::::::::::::::::::::::::init t_axes
Sub t_axes 'draw center axes
Line( 0, t_center_screen_y)-( t_w, t_center_screen_y ), 7
Line( t_center_screen_x, 0)-( t_center_screen_x, t_h ), 7
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_axes

'::::::::::::::::::::::::::::::::::::::::::::::::init t_init
Sub t_init 'init turtle
'parametros comunes
ScreenInfo t_w, t_h
t_center_screen_x = t_w \ 2
t_center_screen_y = t_h \ 2
t_position_x = t_center_screen_x
t_position_y = t_center_screen_y
t_heading = 0
t_pen = 1
t_scale = 1
Color 15

'Figures parameters
't_shapes = 1 'enables or disables the Figures, values 0/1
t_thickness = 0 'thickness of figures and text, values 0...
t_gross = 2 'thickness hollow Figures, values 0/4
t_bold = 0 'thickness of Figures, values 0/1
t_hole = 0 'enables or disables the hollow of Figures, values 0/1
t_color = 2 'color Figures, values 1...
t_hole_color = 3 'color lines, circles, ellipses, star, values 0 ..

'text parameters
't_text_key = 1 'enables or disables the text, values 0/1
t_rottext = 0 ' rotation text, values 0/360
t_text_thickness = 0 'thickness of figures and text, values 0...
t_text_bold = 0 'enables or disables the bold text, values 0/1
t_text_hole = 0 'Enable or disable the hole text, values 0/1
t_text_color = 4 'Color chars, numbers, symbols, values 0 ..
t_text_hole_color = 5 'colored hole chars values 0 ..
t_text_gross = 2 'text hollow thickness, values 1...4

End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_init

'+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Sub t_init_new 'if screen resulution is change during run of program
ScreenInfo t_w, t_h
t_center_screen_x = t_w \ 2
t_center_screen_y = t_h \ 2
t_position_x = t_center_screen_x
t_position_y = t_center_screen_y
End Sub
'+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

'::::::::::::::::::::::::::::::::::::::::::::::::init t_aphoteme
Function t_aphoteme (ByVal t_r As Double, ByVal t_nside As Integer) As Double 'calculate aphoteme
Dim As Double t_rgrad = t_radians(360/t_nside), t_hip
t_x0 = (t_r * Cos(0)) + t_position_x
t_y0 = (t_r * Sin(0)) + t_position_y
t_x1 = (t_r * Cos(t_rgrad)) + t_position_x
t_y1 = (t_r * Sin(t_rgrad)) + t_position_y
t_x2 = Abs(t_x0 - t_x1)
t_y2 = Abs(t_y0 - t_y1)
t_hip = Sqr(t_x2*t_x2 + t_y2*t_y2)
Return Sqr(t_r*t_r - (t_hip/2)^2)
End Function
'::::::::::::::::::::::::::::::::::::::::::::::::end t_aphoteme

'::::::::::::::::::::::::::::::::::::::::::::::::init t_home
Sub t_home 'go home turtle
'if t_pen = 1 then line (t_position_x, t_position_y)-(t_center_screen_x,t_center_screen_y)
t_pen = 0
t_position_x = t_w \ 2
t_position_y = t_h \ 2
t_pen = 1
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_home

'::::::::::::::::::::::::::::::::::::::::::::::::init t_segment
' The Bresenham line algorithm: works only with integer value's
Sub t_segment (ByVal t_lx1 As Integer, ByVal t_ly1 As Integer, ByVal t_lx2 As Integer, ByVal t_ly2 As Integer)

#Macro bresenham (thick, col)
Do
Circle (t_lx1, t_ly1), thick, col,,,,f
If t_lx1 = t_lx2 And t_ly1 = t_ly2 Then Exit Do
e2 = er2 * 2
If e2 > -dy Then
er2 -= dy
t_lx1 += sx
End If
If t_lx1 = t_lx2 And t_ly1 = t_ly2 Then
Circle (t_lx1, t_ly1), thick, col,,,,f
Exit Do
End If
If e2 < dx Then
er2 += dx
t_ly1 += sy
End If
Loop
#EndMacro

Dim As Integer dx = Abs(t_lx2-t_lx1), sx = IIf(t_lx1 < t_lx2, 1, -1)
Dim As Integer dy = Abs(t_ly2-t_ly1), sy = IIf(t_ly1 < t_ly2, 1, -1)
Dim As Integer tmp_x1 = t_lx1, tmp_y1 = t_ly1
Dim As Integer e2, er2 = dx - dy

bresenham(t_thickness, t_color) 'normal

If t_hole = 1 Then ' hollow
t_lx1 = tmp_x1
t_ly1 = tmp_y1
er2 = dx - dy
Dim As Double tmp = t_thickness / t_gross
bresenham(tmp, t_hole_color)
End If

End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_segment

'+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
' macro for t_gt, t_fd, t_bk
#Macro mac_move ()
If t_pen = 1 Then
If t_bold = 1 And t_thickness > 0 Then
t_segment (t_position_x, t_position_y, t_new_position_x, t_new_position_y)
Else
Line (t_position_x, t_position_y) - (t_new_position_x, t_new_position_y), t_color
End If
End If
t_position_x = t_new_position_x
t_position_y = t_new_position_y
#EndMacro
'+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

'::::::::::::::::::::::::::::::::::::::::::::::::init t_gt
Sub t_gt (ByVal t_x As Double, ByVal t_y As Double) 'go to new position x,y
t_x *= t_scale
t_y *= -t_scale ' to fix swap y-axe
t_new_position_x = t_center_screen_x + t_x
t_new_position_y = t_center_screen_y + t_y
mac_move ()
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_gt

'::::::::::::::::::::::::::::::::::::::::::::::::init t_fd
Sub t_fd (ByVal t_distance As Double)'forward x distance
t_distance = t_distance * t_scale
t_new_position_x = t_position_x + (t_distance * Cos(t_heading))
t_new_position_y = t_position_y - (t_distance * Sin(t_heading))
mac_move()
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_fd

'::::::::::::::::::::::::::::::::::::::::::::::::init t_bk
Sub t_bk (ByVal t_distance As Double)'back x distance
t_distance = t_distance * t_scale
t_new_position_x = t_position_x - ( t_distance * Cos(t_heading))
t_new_position_y = t_position_y + ( t_distance * Sin(t_heading))
mac_move()
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_bk

'::::::::::::::::::::::::::::::::::::::::::::::::init t_position
Sub t_position (ByVal t_x As Double, ByVal t_y As Double)
t_pen = 0
t_gt (t_x,t_y)
't_position_x = t_x
't_position_y = t_y
t_pen = 1
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_position

'::::::::::::::::::::::::::::::::::::::::::::::::init t_circle
Sub t_circle (ByVal t_r1 As Double)
'draw a circle
't_r = radius circle
If t_pen <> 1 Then Exit Sub

Dim As Double t_rgrad, t_grad

t_r1 *= t_scale
t_x1 = (t_r1 * Cos(0)) + t_position_x
t_y1 = -(t_r1 * Sin(0)) + t_position_y

For t_grad = 1 To 360
' the first point is allready known, we can start with 1
' 360 is needed to close the line in case of t_bold <> 1 and t_thickness = 0
t_rgrad = t_radians (t_grad)
t_x2 = (t_r1 * Cos(t_rgrad)) + t_position_x
t_y2 = -(t_r1 * Sin(t_rgrad)) + t_position_y
If t_bold = 1 And t_thickness > 0 Then
Circle (t_x2, t_y2),t_thickness,t_color,,,,f
Else
Line (t_x1, t_y1)-(t_x2, t_y2),t_color
t_x1 = t_x2
t_y1 = t_y2
End If
Next t_grad
If t_hole = 1 And t_bold = 1 And t_thickness > 0 Then
Dim As Double tmp = t_thickness / t_gross
For t_grad = 0 To 359
t_rgrad = t_radians (t_grad)
t_x2 = (t_r1 * Cos(t_rgrad)) + t_position_x
t_y2 = -(t_r1 * Sin(t_rgrad)) + t_position_y
Circle (t_x2, t_y2),tmp,t_hole_color,,,,f
Next t_grad
End If

End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_circle

'::::::::::::::::::::::::::::::::::::::::::::::::init t_poly
Sub t_poly (ByVal t_r As Double, ByVal t_nside As Integer, ByVal t_ini As Double = 0 )
'draw and rotate a polygon
't_r = radius polygon
't_nside = number of sides
't_ang_rot = degrees of rotation

If t_pen <> 1 Then Exit Sub

Dim As Double t_rgrad, t_grad
t_end = t_ini + 360
t_r *= t_scale
t_rgrad = t_radians (t_ini)
t_x1 = (t_r * Cos(t_rgrad)) + t_position_x
t_y1 = -(t_r * Sin(t_rgrad)) + t_position_y
t_first_position_x = t_x1
t_first_position_y = t_y1
For t_grad = t_ini To t_end Step 360/t_nside
t_rgrad = t_radians (t_grad)
t_x2 = (t_r * Cos(t_rgrad)) + t_position_x
t_y2 = -(t_r * Sin(t_rgrad)) + t_position_y
If t_bold = 1 And t_thickness > 0 Then
t_segment (t_x1, t_y1, t_x2, t_y2)
Else
Line (t_x1, t_y1)-(t_x2, t_y2),t_color
End If
t_x1 = t_x2
t_y1 = t_y2
Next t_grad
t_x1 = t_first_position_x
t_y1 = t_first_position_y
If t_hole = 1 And t_bold = 1 And t_thickness > 0 Then
Dim As Double tmp = t_thickness / t_gross
For t_grad = t_ini To t_end Step 360/t_nside
t_rgrad = t_radians (t_grad)
t_x2 = (t_r * Cos(t_rgrad)) + t_position_x
t_y2 = -(t_r * Sin(t_rgrad)) + t_position_y
t_segment (t_x1, t_y1, t_x2, t_y2)
t_x1 = t_x2
t_y1 = t_y2
Next t_grad
End If

End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_poly

'::::::::::::::::::::::::::::::::::::::::::::::::init t_arc_cir
Sub t_arc_cir (ByVal t_r1 As Double, ByVal t_ini As Double, ByVal t_end As Double, ByVal t_ang_rot As Double = 0,ByVal t_sec As Integer = 0)'draw a arc circle
If t_pen <> 1 Then Exit Sub
'draw a arc cir
't_r = radius circle
't_ini = angle init
't_end = angle end
't_ang_rot = angle of rotation
Dim As Double t_rgrad, t_grad
t_ini += t_ang_rot
t_end += t_ang_rot
t_r1 *= t_scale
t_rgrad = t_radians (t_ini)
t_x1 = (t_r1 * Cos(t_rgrad)) + t_position_x
t_y1 = -(t_r1 * Sin(t_rgrad)) + t_position_y
If t_sec = 1 Then
If t_bold = 1 And t_thickness > 0 Then
t_segment(t_position_x, t_position_y,t_x1, t_y1)
Else
Line (t_position_x, t_position_y)-(t_x1, t_y1),t_color
End If
End If
For t_grad = t_ini To t_end
t_rgrad = t_radians (t_grad)
t_x2 = (t_r1 * Cos(t_rgrad)) + t_position_x
t_y2 = -(t_r1 * Sin(t_rgrad)) + t_position_y
If t_bold = 1 And t_thickness > 0 Then
Circle (t_x2, t_y2),t_thickness,t_color,,,,f
Else
Line (t_x1, t_y1)-(t_x2, t_y2),t_color
t_x1 = t_x2
t_y1 = t_y2
End If
Next t_grad
If t_hole = 1 And t_bold = 1 And t_thickness > 0 Then
Dim As Double tmp = t_thickness / t_gross
For t_grad = t_ini To t_end
t_rgrad = t_radians (t_grad)
t_x2 = (t_r1 * Cos(t_rgrad)) + t_position_x
t_y2 = -(t_r1 * Sin(t_rgrad)) + t_position_y
Circle (t_x2, t_y2),tmp,t_hole_color,,,,f
Next t_grad
End If
If t_sec = 1 Then
If t_bold = 1 And t_thickness > 0 Then
t_segment(t_x2, t_y2, t_position_x, t_position_y)
Else
Line (t_x2, t_y2)-(t_position_x, t_position_y),t_color
End If
End If

End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_arc_cir

'::::::::::::::::::::::::::::::::::::::::::::::::init t_sec_cir
Sub t_sec_cir (ByVal t_r1 As Double, ByVal t_ini As Double, ByVal t_end As Double, ByVal t_ang_rot As Double=0)'draw a arc circle
t_arc_cir(t_r1, t_ini, t_end, t_ang_rot, 1)
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_sec_cir

'::::::::::::::::::::::::::::::::::::::::::::::::init t_ellipse
Sub t_ellipse (ByVal t_r1 As Double, ByVal t_r2 As Double,ByVal t_ang_rot As Double)
'draw a ellipse with rotation
't_r1 = radius bigger
't_r2 = radius smaller
't_ang_rot = degrees to rotate
If t_pen <> 1 Then Exit Sub
Dim As Double t_rgrad, t_grad, t_x3, t_y3
Dim As Double _s_ang_rot = Sin(t_radians (t_ang_rot))
Dim As Double _c_ang_rot = Cos(t_radians (t_ang_rot))
t_r1 = t_r1 * t_scale
t_r2 = t_r2 * t_scale
t_x0 = (t_r1 * Cos(0))
t_y0 = (t_r2 * Sin(0))
t_x1 = (t_x0 * _c_ang_rot) - (t_y0 * _s_ang_rot) + t_position_x
t_y1 = -(t_x0 * _s_ang_rot) - (t_y0 * _c_ang_rot) + t_position_y
For t_grad = 1 To 360
t_rgrad = t_radians (t_grad)
t_x2 = (t_r1 * Cos(t_rgrad))
t_y2 = (t_r2 * Sin(t_rgrad))
t_x3 = (t_x2 * _c_ang_rot) - (t_y2 * _s_ang_rot) + t_position_x
t_y3 = -(t_x2 * _s_ang_rot) - (t_y2 * _c_ang_rot) + t_position_y
If t_bold = 1 And t_thickness > 0 Then
Circle (t_x3, t_y3),t_thickness, t_color,,,,f
Else
Line (t_x1, t_y1)-(t_x3, t_y3),t_color
t_x1 = t_x3
t_y1 = t_y3
End If
Next t_grad
If t_hole = 1 And t_bold = 1 And t_thickness > 0 Then
Dim As Double tmp = t_thickness / t_gross
For t_grad = 0 To 359
t_rgrad = t_radians (t_grad)
t_x2 = (t_r1 * Cos(t_rgrad))
t_y2 = (t_r2 * Sin(t_rgrad))
t_x3 = (t_x2 * _c_ang_rot) - (t_y2 * _s_ang_rot) + t_position_x
t_y3 = -(t_x2 * _s_ang_rot) - (t_y2 * _c_ang_rot) + t_position_y
Circle (t_x3, t_y3),tmp, t_hole_color,,,,f
Next t_grad
End If
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_ellipse

':::::::::::::::::::::::::::::::::::::::::::::::init t_arc_ellip
Sub t_arc_ellip (ByVal t_r1 As Double, ByVal t_r2 As Double, ByVal t_ini As Double, ByVal t_end As Double, ByVal t_ang_rot As Double = 0, t_sec As Integer = 0)
'draw a arc. elliptic
't_r1 = radius 1
't_r2 = radius 2
't_ini = angle init
't_end = angle end
't_ang_rot = angle of rotation
't_sec = 0 = arc. ellipse, 1 = sec. ellipse
If t_pen <> 1 Then Exit Sub
Dim As Double t_rgrad, t_grad, t_x3, t_y3
Dim As Double _s_ang_rot = Sin(t_radians (t_ang_rot))
Dim As Double _c_ang_rot = Cos(t_radians (t_ang_rot))
t_r1 = t_r1 * t_scale
t_r2 = t_r2 * t_scale
t_rgrad = t_radians (t_ini)
t_x0 = (t_r1 * Cos(t_rgrad))
t_y0 = (t_r2 * Sin(t_rgrad))
t_x1 = (t_x0 * _c_ang_rot) - (t_y0 * _s_ang_rot) + t_position_x
t_y1 = -(t_x0 * _s_ang_rot) - (t_y0 * _c_ang_rot) + t_position_y
If t_sec = 1 Then
If t_bold = 1 And t_thickness > 0 Then
t_segment (t_position_x, t_position_y, t_x1, t_y1)
Else
Line (t_position_x, t_position_y)-(t_x1, t_y1), t_color
End If
End If
For t_grad = t_ini To t_end
t_rgrad = t_radians (t_grad)
t_x2 = (t_r1 * Cos(t_rgrad))
t_y2 = (t_r2 * Sin(t_rgrad))
t_x3 = (t_x2 * _c_ang_rot) - (t_y2 * _s_ang_rot) + t_position_x
t_y3 = -(t_x2 * _s_ang_rot) - (t_y2 * _c_ang_rot) + t_position_y
If t_bold = 1 And t_thickness > 0 Then
Circle(t_x3, t_y3), t_thickness,t_color,,,,f
Else
Line (t_x1, t_y1)-(t_x3, t_y3),t_color
t_x1 = t_x3
t_y1 = t_y3
End If
Next t_grad
If t_hole = 1 And t_bold = 1 And t_thickness > 0 Then
Dim As Double tmp = t_thickness / t_gross
For t_grad = t_ini To t_end
t_rgrad = t_radians (t_grad)
t_x2 = (t_r1 * Cos(t_rgrad))
t_y2 = (t_r2 * Sin(t_rgrad))
t_x3 = (t_x2 * _c_ang_rot) - (t_y2 * _s_ang_rot) + t_position_x
t_y3 = -(t_x2 * _s_ang_rot) - (t_y2 * _c_ang_rot) + t_position_y
Circle(t_x3, t_y3), tmp,t_hole_color,,,,f
Next t_grad
End If
If t_sec = 1 Then
If t_bold = 1 And t_thickness > 0 Then
t_segment (t_x3, t_y3, t_position_x, t_position_y)
Else
Line (t_x3, t_y3)-(t_position_x, t_position_y), t_color
End If
End If
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_arc_ellip

':::::::::::::::::::::::::::::::::::::::::::::::init t_sec_ellip
Sub t_sec_ellip (ByVal t_r1 As Double, ByVal t_r2 As Double, ByVal t_ini As Double, ByVal t_end As Double,ByVal t_ang_rot As Double = 0)
'draw a sector elliptic
't_r1 = radius 1
't_r2 = radius 2
't_ini = angle init
't_end = angle end
't_ang_rot = angle of rotation
't_sec = make it a sec. ellipse
t_arc_ellip (t_r1, t_r2, t_ini, t_end, t_ang_rot, 1)'draw a elliptic sector
End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_arc_ellip

'::::::::::::::::::::::::::::::::::::::::::::::::init t_star
Sub t_star (ByVal t_np As Integer, ByVal t_rg As Double, ByVal t_rp As Double, ByVal t_ini As Double = 0)

If t_pen <> 1 Then Exit Sub

Dim As Integer c
Dim As Double np = 180, n, t_rgrad
If t_np <> 0 Then np = Abs(180 / t_np)
t_end = t_ini + 360 + np
t_rg *= t_scale
t_rp *= t_scale
t_rgrad = t_radians (t_ini)
t_x1 = (t_rg * Cos(t_rgrad)) + t_position_x
t_y1 = -(t_rg * Sin(t_rgrad)) + t_position_y
For n = t_ini To t_end Step np
t_r = IIf((c And 1) = 0, t_rg, t_rp)
t_rgrad = t_radians (n)
t_x2 = (t_r * Cos(t_rgrad)) + t_position_x
t_y2 = -(t_r * Sin(t_rgrad)) + t_position_y
If t_bold = 1 And t_thickness > 0 Then
t_segment (t_x1, t_y1, t_x2, t_y2)
Else
Line (t_x1, t_y1)-(t_x2, t_y2),t_color
End If
t_x1 = t_x2
t_y1 = t_y2
c += 1
Next n

End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::end t_star

'=======================================================================
' characters are defined before use by t_text
'=======================================================================
Sub t_let_a 'ucase a
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 5 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 2 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 2 : t_rt 90 : t_fd 4 : t_bk 4 : t_lt 90 : t_fd 3 : t_lt 90
t_pen = 0 : t_fd 1 + t_margin
End Sub

Sub t_let_b 'ucase b
t_fd 1 + t_margin
t_pen = 1 : t_fd 3 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 3 : t_bk 3 : t_rt 135 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 3 : t_lt 90 : t_fd 6 : t_lt 90
t_pen = 0 : t_fd 5 + t_margin
End Sub

Sub t_let_c 'ucase c
t_fd 2 + t_margin
t_pen = 1 : t_fd 2 : t_lt 45 : t_fd 1.414 : t_lt 45
t_pen = 0 : t_fd 4
t_pen = 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 2 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 4 : t_lt 45 : t_fd 1.414 : t_lt 45
t_pen = 0 : t_fd 4 + t_margin
End Sub

Sub t_let_d 'ucase d
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_rt 90 : t_fd 3 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 4 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 3 : t_bk 3 : t_rt 180
t_pen = 0 : t_fd 2 + t_margin
End Sub

Sub t_let_e 'ucase e
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_rt 90 : t_fd 4 : t_bk 4 : t_rt 90 : t_fd 3 : t_lt 90 : t_fd 2 : t_bk 2 : t_rt 90 : t_fd 3 : t_lt 90 : t_fd 4
t_pen = 0 : t_fd 1 + t_margin
End Sub

Sub t_let_f 'ucase f
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_rt 90 : t_fd 4 : t_bk 4 : t_rt 90 : t_fd 3 : t_lt 90 : t_fd 2 : t_bk 2 : t_rt 90 : t_fd 3 : t_lt 90
t_pen = 0 : t_fd 5 + t_margin
End Sub

Sub t_let_g 'ucase g
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_rt 90 : t_fd 4 : t_bk 4 : t_rt 90 : t_fd 6 : t_lt 90 : t_fd 4 : t_lt 90 : t_fd 3 : t_lt 90 : t_fd 2
t_pen = 0 : t_bk 2 : t_lt 90 : t_fd 3: t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_let_h 'ucase h
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_bk 3 : t_rt 90 : t_fd 4 : t_lt 90 : t_fd 3 : t_bk 6
t_pen = 0 : t_lt 90 : t_bk 1 + t_margin
End Sub

Sub t_let_i 'ucase i
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_bk 6 : t_rt 90
t_pen = 0 : t_fd 1 + t_margin
End Sub

Sub t_let_j 'ucase j
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 3 : t_bk 3 : t_rt 90 : t_fd 4 : t_lt 90 : t_fd 6
t_pen = 0 : t_bk 6 : t_rt 90 : t_fd 1 + t_margin
End Sub

Sub t_let_k 'ucase k
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6
t_pen = 0 : t_rt 90 : t_fd 3 : t_rt 135
t_pen = 1 : t_fd 4.243 : t_lt 90 : t_fd 4.243
t_pen = 0 : t_lt 45 : t_fd 1 + t_margin
End Sub

Sub t_let_l 'ucase l
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_bk 6 : t_rt 90 : t_fd 4
t_pen = 0 : t_fd 1 + t_margin
End Sub

Sub t_let_m 'ucase m
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_rt 146.31 : t_fd 3.605 : t_lt 112.62 : t_fd 3.605 : t_rt 146.31 : t_fd 6 : t_lt 90
t_pen = 0 : t_fd 1 + t_margin
End Sub

Sub t_let_n 'ucase n
t_fd 1 + t_margin: t_lt 90
t_pen = 1 : t_fd 6 : t_rt 146.31 : t_fd 7.211 : t_lt 146.31 : t_fd 6
t_pen = 0 : t_bk 6 : t_rt 90 : t_fd 1 + t_margin
End Sub

Sub t_let_o 'ucase o
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_rt 90 : t_fd 4 : t_rt 90 : t_fd 6 : t_rt 90 : t_fd 4
t_pen = 0 : t_bk 5 + t_margin
End Sub

Sub t_let_p 'ucase p
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_rt 90 : t_fd 3 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 3 : t_lt 90 : t_fd 3 : t_lt 90
t_pen = 0 : t_fd 5 + t_margin
End Sub

Sub t_let_q 'ucase q
t_fd 2 + t_margin : t_lt 90
t_pen = 1 : t_lt 45 : t_fd 1.414 : t_rt 45 : t_fd 4 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 2 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 4 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 2
t_pen = 0 : t_bk 3 : t_rt 45
t_pen = 1 : t_fd 3
t_pen = 0 : t_bk 3 : t_rt 135 : t_fd 1 + t_margin
End Sub

Sub t_let_r 'ucase r
t_fd 1 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_rt 90 : t_fd 3 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 3 : t_lt 143.13 : t_fd 5 : t_lt 36.87
t_pen = 0 : t_fd 1 + t_margin
End Sub

Sub t_let_s 'ucase s
t_fd 2 + t_margin : t_lt 135
t_pen = 1 : t_fd 1.414 : t_bk 1.414 : t_rt 135 : t_fd 2 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 2 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 2 : t_rt 45 : t_fd 1.414 : t_rt 45
t_pen = 0 : t_fd 5 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_let_t 'ucase t
t_fd 3 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_lt 90 : t_fd 2 : t_bk 4 : t_lt 90
t_pen = 0 : t_fd 6 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_let_u 'ucase u
t_fd 1 + t_margin : t_lt 90 : t_fd 6
t_pen = 1 : t_bk 5 : t_rt 135 : t_fd 1.414 : t_lt 45 : t_fd 2 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 5
t_pen = 0 : t_bk 6 : t_rt 90 : t_fd 1 + t_margin
End Sub

Sub t_let_v 'ucase v
t_fd 3 + t_margin : t_lt 108.426
t_pen = 1 : t_fd 6.324 : t_bk 6.324 : t_rt 36.872 : t_fd 6.324 : t_rt 161.564
t_pen = 0 : t_fd 6 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_let_w 'ucase w
t_fd 1 + t_margin : t_lt 90 : t_fd 6 : t_rt 170.54
t_pen = 1 : t_fd 6.083 : t_lt 152.1 : t_fd 3.162 : t_rt 143.13 : t_fd 3.162 : t_lt 152.1 : t_fd 6.083
t_pen = 0 : t_rt 170.54 : t_fd 6 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_let_x 'ucase x
t_fd 1 + t_margin : t_lt 56.31
t_pen = 1 : t_fd 7.21 : t_lt 123.69
t_pen = 0 : t_fd 4
t_pen = 1 : t_lt 123.69 : t_fd 7.21 : t_lt 56.31
t_pen = 0 : t_fd 1 + t_margin
End Sub

Sub t_let_y 'ucase y
t_fd 1 + t_margin : t_lt 56.31
t_pen = 1 : t_fd 7.21 : t_lt 123.69
t_pen = 0 : t_fd 4
t_pen = 1 : t_lt 123.69 : t_fd 3.61
t_pen = 0 : t_fd 3.6 : t_lt 56.31 : t_fd 1 + t_margin
End Sub

Sub t_let_z 'ucase z
t_fd 1 + t_margin : t_lt 56.31
t_pen = 1 : t_fd 7.21 : t_lt 123.69 : t_fd 4
t_pen = 0 : t_lt 90 : t_fd 6 : t_lt 90
t_pen = 1 : t_fd 4
t_pen = 0 : t_fd 1 + t_margin
End Sub

'numbers
Sub t_num_1 'number 1
t_fd 1 + t_margin : t_lt 90 : t_fd 4
t_pen = 1 : t_rt 45 : t_fd 1.414*2 : t_rt 135 : t_fd 6 : t_lt 90
t_pen = 0 : t_fd 1 + t_margin
End Sub

Sub t_num_2 'number 2
t_fd 1 + t_margin : t_lt 90 : t_fd 5
t_pen = 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 37 : t_fd 5 : t_lt 127 : t_fd 3
t_pen = 0 : t_fd 1 + t_margin
End Sub

Sub t_num_3 'number 3
t_fd 1 + t_margin : t_lt 90 : t_fd 5
t_pen = 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_lt 90 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_bk 1.414 : t_rt 135
t_pen = 0 : t_fd 3 + t_margin
End Sub

Sub t_num_4 'number 4
t_fd 4 + t_margin : t_lt 90
t_pen = 1 : t_fd 6 : t_lt 135 : t_fd 1.414*3 : t_lt 135 : t_fd 3 : t_rt 90
t_pen = 0 : t_fd 3 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_num_5 'number 5
t_fd 2 + t_margin : t_lt 135
t_pen = 1 : t_fd 1.414 : t_bk 1.414 : t_rt 135 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 2 : t_rt 90 : t_fd 3 : t_rt 90 : t_fd 3 : t_rt 90
t_pen = 0 : t_fd 6 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_num_6 'number 6
t_fd 2 + t_margin : t_lt 135
t_pen = 1 : t_fd 1.414 : t_bk 1.414 : t_rt 135 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_bk 4 : t_rt 225 : t_fd 1.414 : t_rt 45 : t_fd 2 : t_rt 90
t_pen = 0 : t_fd 6 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_num_7 'number 7
t_fd 1 + t_margin : t_lt 63.43
t_pen = 1 : t_fd 6.71 : t_lt 116.56 : t_fd 3 : t_lt 90
t_pen = 0 : t_fd 6 : t_lt 90 : t_fd 4 + t_margin
End Sub

Sub t_num_8 'number 8
t_fd 2 + t_margin
t_pen = 1 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_bk 1 : t_rt 135 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_rt 90 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45
t_pen = 0 : t_fd 3 + t_margin
End Sub

Sub t_num_9 'number 9
t_fd 1 + t_margin
t_pen = 1 : t_fd 2 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 4
For t_n= 0 To 2
t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1
Next t_n
t_lt 45 : t_fd 1.414
t_pen = 0 : t_rt 135 : t_fd 4 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_num_0 'number 0
t_fd 2 + t_margin : t_lt 135
t_pen = 1 : t_fd 1.414 : t_rt 45 : t_fd 4 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 4 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1
t_pen = 0 : t_bk 3 + t_margin
End Sub

'symbols
Sub t_sym_1 'symbol (
t_fd 2 + t_margin : t_lt 135
t_pen = 1 : t_fd 1.414 : t_rt 45 : t_fd 4 : t_rt 45 : t_fd 1.414 : t_rt 135
t_pen = 0 : t_fd 6 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_2 'symbol )
t_fd 1 + t_margin : t_lt 45
t_pen = 1 : t_fd 1.414 : t_lt 45 : t_fd 4 : t_lt 45 : t_fd 1.414 : t_lt 135
t_pen = 0 : t_fd 6 : t_lt 90 : t_fd 2 + t_margin
End Sub

Sub t_sym_3 'symbol [
t_fd 1 + t_margin
t_pen = 1 : t_fd 1 : t_bk 1 : t_lt 90 : t_fd 6 : t_rt 90 : t_fd 1 : t_rt 90
t_pen = 0 : t_fd 6 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_4 'symbol ]
t_fd 1 + t_margin
t_pen = 1 : t_fd 1 : t_lt 90 : t_fd 6 : t_lt 90 : t_fd 1 : t_lt 90
t_pen = 0 : t_fd 6 : t_lt 90 : t_fd 2 + t_margin
End Sub

Sub t_sym_5 'symbol !
t_fd 1 + t_margin
t_pen = 1 : t_lt 90 : t_fd 1
t_pen = 0 : t_fd 2
t_pen = 1 : t_fd 3
t_pen = 0 : t_bk 6 : t_rt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_6 'symbol ¡
t_fd 1 + t_margin
t_pen = 1 : t_lt 90 : t_fd 3
t_pen = 0 : t_fd 2
t_pen = 1 : t_fd 1
t_pen = 0 : t_bk 6 : t_rt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_7 'symbol ?
t_fd 1 + t_margin : t_lt 90 : t_fd 4
t_pen = 1 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_rt 45 : t_fd 1 : t_rt 45 : t_fd 1.414 : t_lt 45 : t_fd 1
t_pen = 0 : t_fd 1
t_pen = 1 : t_fd 1
t_pen = 0 : t_lt 90 : t_fd 2 + t_margin
End Sub

Sub t_sym_8 'symbol ¿
t_fd 1 + t_margin : t_lt 90 : t_fd 6 : t_rt 90 : t_fd 1 : t_rt 90
t_pen = 1 : t_fd 1
t_pen = 0 : t_fd 1
t_pen = 1 : t_fd 1 : t_rt 90 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1 : t_lt 45 : t_fd 1.414 : t_lt 45 : t_fd 1
t_pen = 0 : t_bk 2 : t_rt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_10 'symbol -
t_fd 1 + t_margin : t_lt 90 : t_fd 3 : t_rt 90
t_pen = 1 : t_fd 3
t_pen = 0 : t_rt 90 : t_fd 3 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_11 'symbol .
t_fd 1 + t_margin
t_pen = 1 : t_fd 1 : t_lt 90 : t_fd 1 : t_lt 90 : t_fd 1 : t_lt 90 : t_fd 1 : t_lt 90
t_pen = 0 : t_fd 2 + t_margin
End Sub

Sub t_sym_12 'symbol :
t_fd 1 + t_margin
t_pen = 1 : t_fd 1 : t_lt 90 : t_fd 1 : t_lt 90 : t_fd 1 : t_lt 90 : t_fd 1
t_pen = 0 : t_bk 2
t_pen = 1 : t_bk 1 : t_lt 90 : t_fd 1 : t_rt 90 : t_fd 1 : t_rt 90 : t_fd 1
t_pen = 0 : t_lt 90 : t_fd 2 : t_lt 90 : t_fd 2 + t_margin
End Sub

Sub t_sym_13 'symbol +
t_fd 3 + t_margin : t_lt 90 : t_fd 1.5
t_pen = 1 : t_fd 3 : t_bk 1.5 : t_lt 90 : t_fd 1.5 : t_bk 3
t_pen = 0 : t_lt 90 : t_fd 3 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_14 'symbol * 5 point star
t_fd 3 + t_margin : t_lt 90 : t_fd 3
t_pen = 1 : t_fd 2
For t_n= 0 To 3
t_bk 2 : t_lt 72 : t_fd 2
Next t_n
t_pen = 0 : t_rt 108 : t_fd 3.618 : t_lt 90 : t_fd 1.098 + t_margin
End Sub

/'
Sub t_sym_14 'symbol * 6 point star
t_fd 3 + t_margin : t_lt 90 : t_fd 0.7
t_pen = 1 : t_fd 4.6
for t_nAs Integer = 0 To 1
t_pen = 0 : t_rt 120 : t_fd 2.3 : t_rt 120
t_pen = 1 : t_fd 4.6
Next
t_pen = 0 : t_rt 60 : t_fd 1.85 : t_lt 90 : t_fd 1.008 + t_margin
End Sub
'/
Sub t_sym_15 'symbol /
t_fd 1 + t_margin : t_lt 63.43
t_pen = 1 : t_fd 6.71 :
t_pen = 0 : t_bk 6.71 : t_rt 63.43 : t_fd 4 + t_margin
End Sub

Sub t_sym_16 'symbol \
t_fd 4 + t_margin : t_lt 116.57
t_pen = 1 : t_fd 6.71
t_pen = 0 : t_bk 6.71 : t_rt 116.57 : t_fd 1 + t_margin
End Sub

Sub t_sym_17 'symbol >
t_fd 1 + t_margin : t_lt 90 : t_fd 1 : t_rt 90 : t_lt 45
t_pen = 1 : t_fd 1.414*2 : t_lt 90 : t_fd 1.414*2
t_pen = 0 : t_lt 135 : t_fd 5 : t_lt 90 : t_fd 3 + t_margin
End Sub

Sub t_sym_18 'symbol <
t_fd 3 + t_margin : t_lt 90 : t_fd 1 : t_rt 90 : t_lt 135
t_pen = 1 : t_fd 1.414*2 : t_rt 90 : t_fd 1.414*2
t_pen = 0 : t_rt 135 : t_fd 5 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_19 'symbol =
t_fd 1 + t_margin : t_lt 90 : t_fd 2 : t_rt 90
t_pen = 1 : t_fd 3
t_pen = 0 : t_lt 90 : t_fd 2 : t_lt 90
t_pen = 1 : t_fd 3
t_pen = 0 : t_lt 90 : t_fd 4 : t_lt 90 : t_fd 4 + t_margin
End Sub

Sub t_sym_20 'symbol #
t_fd 1 + t_margin : t_lt 90 : t_fd 2.5 : t_rt 90
t_pen = 1 : t_fd 3
t_pen = 0 : t_lt 90 : t_fd 1 : t_lt 90
t_pen = 1 : t_fd 3 : t_rt 90
t_pen = 0 : t_fd 2.5 : t_rt 90 : t_fd 1 : t_rt 90
t_pen = 1 : t_fd 6 : t_lt 90
t_pen = 0 : t_fd 1 : t_lt 90
t_pen = 1 : t_fd 6
t_pen = 0 : t_bk 6 : t_rt 90 : t_fd 2 + t_margin
End Sub

Sub t_sym_21 'symbol,
t_fd 1 + t_margin : t_lt 45
t_pen = 1 : t_fd 1.414
t_pen = 0 : t_rt 135 : t_fd 1 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_22 'symbol ;
t_fd 1 + t_margin : t_lt 45
t_pen = 1 : t_fd 1.414
t_pen = 0 : t_lt 45 : t_fd 1
t_pen = 1 : t_fd 1 : t_lt 90 : t_fd 1 : t_lt 90 : t_fd 1 : t_lt 90 : t_fd 1 : t_rt 90
t_pen = 0 : t_fd 2 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_23 'symbol $
t_fd 2 + t_margin : t_lt 90 : t_fd 1 : t_rt 90 : t_lt 135
t_pen = 1 : t_fd 1.414 : t_bk 1.414 : t_rt 135 : t_fd 2 : t_lt 45 : t_fd 1.414 : t_lt 90 : t_fd 1.414 : t_lt 45 : t_fd 2 : t_rt 45 : t_fd 1.414 : t_rt 90 : t_fd 1.414 : t_rt 45 : t_fd 2 : t_rt 45 : t_fd 1.414 : t_rt 45
t_pen = 0 : t_fd 4 : t_rt 90 : t_fd 2 : t_rt 90
t_pen = 1 : t_fd 6
t_pen = 0 : t_rt 90 : t_fd 2 : t_rt 90 : t_fd 6 : t_lt 90 : t_fd 1 + t_margin
End Sub

Sub t_sym_24 'symbol %
t_fd 1 + t_margin : t_lt 63.43
t_pen = 1 : t_fd 6.71 : t_lt 116.57
t_pen = 0 : t_fd 3 : t_lt 90 : t_fd 2
t_pen = 1 : t_lt 90 : t_fd 1 : t_lt 90 : t_fd 1 : t_lt 90 : t_fd 1 : t_lt 90 : t_fd 1
t_pen = 0 : t_fd 4 : t_lt 90 : t_fd 2 : t_lt 90 : t_fd 1
t_pen = 1 : t_fd 1 : t_rt 90 : t_fd 1 : t_rt 90 : t_fd 1 : t_rt 90 : t_fd 1 : t_lt 90
t_pen = 0 : t_fd 1 : t_lt 90 : t_fd 2 + t_margin
End Sub

'================================================
' use the characters defined before
'================================================
'::::::::::::::::::::::::::::::::::::::::::::::::Init t_text
Sub t_text (ByRef t_string As String)

#Macro swapping ()
Swap t_color, t_text_color
Swap t_bold, t_text_bold
Swap t_hole_color, t_text_hole_color
Swap t_thickness, t_text_thickness
Swap t_hole, t_text_hole
Swap t_gross, t_text_gross
#EndMacro

swapping ()
Dim As Double _s = t_scale, _t = t_thickness
Dim As String s
Dim As Integer lower

If t_bold = 1 And t_thickness > 0 Then t_margin = t_thickness / 10 Else t_margin = 0
t_margin += T_SEPARATION
t_pen = 0
For t As Integer = 1 To Len(t_string)
t_orient t_rottext
s = Mid(t_string, t, 1)
If s <> UCase(s) Then
lower = 1
t_scale /= 2 : t_thickness /= 2
s = UCase(s)
EndIf

Select Case s
'char uppers
Case "A" : t_let_a
Case "B" : t_let_b
Case "C" : t_let_c
Case "D" : t_let_d
Case "E" : t_let_e
Case "F" : t_let_f
Case "G" : t_let_g
Case "H" : t_let_h
Case "I" : t_let_i
Case "J" : t_let_j
Case "K" : t_let_k
Case "L" : t_let_l
Case "M" : t_let_m
Case "N" : t_let_n
Case "O" : t_let_o
Case "P" : t_let_p
Case "Q" : t_let_q
Case "R" : t_let_r
Case "S" : t_let_s
Case "T" : t_let_t
Case "U" : t_let_u
Case "V" : t_let_v
Case "W" : t_let_w
Case "X" : t_let_x
Case "Y" : t_let_y
Case "Z" : t_let_z
Case " " : t_fd 2 + t_margin
'NUMBERS
Case "1" : t_num_1
Case "2" : t_num_2
Case "3" : t_num_3
Case "4" : t_num_4
Case "5" : t_num_5
Case "6" : t_num_6
Case "7" : t_num_7
Case "8" : t_num_8
Case "9" : t_num_9
Case "0" : t_num_0
'symbolS
Case "(" : t_sym_1
Case ")" : t_sym_2
Case "[" : t_sym_3
Case "]" : t_sym_4
Case "!" : t_sym_5
Case "¡" : t_sym_6
Case "?" : t_sym_7
Case "¿" : t_sym_8
Case "_" 't_sym_9 underscore
t_pen = 0 : t_fd T_SEPARATION
t_pen = 1 : t_fd 4
t_pen = 0 : t_fd T_SEPARATION
Case "-" : t_sym_10
Case "." : t_sym_11
Case ":" : t_sym_12
Case "+" : t_sym_13
Case "*" : t_sym_14
Case "/" : t_sym_15
Case "\" : t_sym_16
Case ">" : t_sym_17
Case "<" : t_sym_18
Case "=" : t_sym_19
Case "#" : t_sym_20
Case "," : t_sym_21
Case ";" : t_sym_22
Case "$" : t_sym_23
Case "%" : t_sym_24
Case Else
'Print " Missing character. "
'Sleep
t_fd 1 + t_margin : t_pen = 1
t_fd 1 : t_lt 90 : t_fd 3 : t_lt 90
t_fd 1 : t_lt 90 : t_fd 3 : t_lt 90
t_pen = 0 : t_fd 2 + t_margin
End Select
If lower = 1 Then lower = 0 : t_scale = _s : t_thickness = _t
Next t
T_PEN = 1
t_orient 0
swapping ()

End Sub
'::::::::::::::::::::::::::::::::::::::::::::::::End T_text

'::::::::::::::::::::::::::::::::::::::::::::::::init t_grid
Sub t_grid(ByVal t_step_grid As Double) 'draw a grid
Dim As Integer n, t_sssbold, t_ssscolor, t_ssspos_x, t_ssspos_y
Dim As Double t_ssscale

t_ssscale = t_scale
t_sssbold = t_text_bold
t_ssscolor = t_text_color
t_ssspos_x = t_position_x
t_ssspos_y = t_position_y

For n = (t_h\2) Mod t_step_grid To t_h Step t_step_grid
Line(0, n)-(t_w, n), 8 'lineas horizontales
Next n
For n = (t_w\2) Mod t_step_grid To t_w Step t_step_grid
Line(n, 0)-(n, t_h), 8 'lineas verticales
Next n

't_axes () to hilight the x and y ax
Line( 0, t_center_screen_y)-( t_w, t_center_screen_y ), 15
Line( t_center_screen_x, 0)-( t_center_screen_x, t_h ), 15

t_scale = 1
t_text_bold = 0
t_text_color = 15

For n = 0 To t_h\2 Step t_step_grid
If n Mod (t_step_grid * 2) = 0 Then
t_pen = 0 : t_gt(0, n) : t_pen = 1
t_text Str(Int(n/t_ssscale))
t_pen = 0 : t_gt(0, -n) : t_pen = 1
If n<> 0 Then t_text "-"+Str(Int(n/t_ssscale))
EndIf
Next n

For n = t_step_grid To t_w\2 Step t_step_grid
If n Mod (t_step_grid * 2) = 0 Then
t_pen = 0 : t_gt(n, 0) : t_pen = 1
t_text Str(Int(n/t_ssscale))
t_pen = 0 : t_gt(-n, 0) : t_pen = 1
t_text "-"+Str(Int(n/t_ssscale))
EndIf
Next n

t_scale = t_ssscale
t_text_bold = t_sssbold
t_text_color = t_ssscolor
t_position_x = t_ssspos_x
t_position_y = t_ssspos_y
End Sub
':::::::::::::::::::::::::::::::::::::::::::::::end t_grid

':::::::::::::::::::::::::::::::::::::::::::::::: INIT TX_READKEYS
Sub t_read_keys

Dim T_READ_KEY As String
Dim As Integer T_READ_KEY_X, T_READ_KEY_Y
Dim As Integer x, y=9999
Dim As Double tmp_s = t_scale
Dim As Integer tmp_b = t_text_bold
Dim As Integer tmp_tc = t_text_color

t_text_bold = 0
t_text_color = 4
t_scale = 2

Do
T_READ_KEY = Inkey$
Select Case T_READ_KEY
Case "1"
T_READ_KEY_X -= 1
T_READ_KEY_Y -= 1
Case "2"
T_READ_KEY_Y -= 1
Case "3"
T_READ_KEY_X += 1
T_READ_KEY_Y -= 1
Case "5"
T_READ_KEY_X = 0
T_READ_KEY_Y = 0
Case "4"
T_READ_KEY_X -= 1
Case "6"
T_READ_KEY_X += 1
Case "7"
T_READ_KEY_X -= 1
T_READ_KEY_Y += 1
Case "8"
T_READ_KEY_Y += 1
Case "9"
T_READ_KEY_X += 1
T_READ_KEY_Y += 1
Case "*"
Exit Do
End Select
If x <> T_READ_KEY_X Or y <> T_READ_KEY_Y Then
Line (0,0)-(200,24),7,BF
t_position_x = 4 : t_position_y = 20
t_text ("X = " + Str(T_READ_KEY_X) + " * Y = " + Str(T_READ_KEY_Y))
x = T_READ_KEY_X : y = T_READ_KEY_Y
End If
Sleep 0, 1
Loop
t_scale = tmp_s
t_text_bold = tmp_b
t_text_color = tmp_tc
End Sub
':::::::::::::::::::::::::::::::::::::::::::::::: END TX_TX_READ_KEYS

Sub t_ovoid (ByVal t_r1 As Double, ByVal t_r2 As Double, ByVal t_ang_rot As Double)'draw a ovoid
'draw a ovoid
't_r1 = radius 1 (smaller)
't_r2 = radius 2 (bigger)
't_ang_rot = angle of rotation
t_arc_ellip (t_r1,t_r2,0,180,t_ang_rot)
t_arc_cir (t_r1,180,360,t_ang_rot)
End Sub

Sub t_spring (t_ns As Integer, t_rs As Double, t_lo As Double)' draw a t_spring
't_ns = number of spirals
't_rs = stretch of spiral 0...90
't_lo = long of spiral
For n As Integer = 1 To t_ns
t_rt t_rs
t_fd t_lo
t_lt t_rs * 2
t_fd t_lo
t_rt t_rs
Next n
End Sub

'init t_cilinder
Sub t_cilinder ( t_ca As Double, t_cr As Double, t_cd As Double, t_cl As Double, t_cp As Double, t_cs As Double) ' draw a pneumatic cilinder
' draw a pneumatic / hidraulic cilinder

't_ca angle position cilinder
't_cr radius rotation
't_cd diameter cilinder
't_cl long cilinder
't_cp position piston
't_cs suplementary piston

t_color = 15 : t_orient t_ca
't_pen = 0
't_fd t_cr 'rotation radius
't_bk t_cr
t_pen = 1 : t_circle t_cd / 8 'show rotation point
t_pen = 0 : t_fd t_cr
t_pen = 1 : t_rt 90 : t_fd t_cd / 2 : t_rt 90 : t_fd t_cl : t_rt 90 : t_fd t_cd : t_rt 90
t_fd t_cl : t_rt 90 : t_fd t_cd / 2 : t_color = 12 : t_lt 180 : t_fd t_cd /8 : t_rt 90
If t_cp > t_cl Then t_cp = t_cl
If t_cp < 0 Then t_cp = 0
t_fd Abs (t_cp) + t_cs ' salida del vastago + adicional
t_rt 90
't_fd t_cd /8 ' center piston
't_fd t_cd /8 ' center piston
t_fd t_cd / 8 * 2
t_rt 90 : t_fd Abs (t_cp) + t_cs ' salida del vastago + adicional
t_rt 90 : t_fd t_cd /8
t_pen = 0 : t_rt 90 : t_fd Abs (t_cp) + t_cs : t_color = 15
't_pen = 1
End Sub
'end t_cilinder

'init t_manipulator
Sub t_manipulator (t_mla As Double, t_mlp As Double, t_mp As Double, t_mrot As Double, t_mlc As Double)
' draw manipulator

' t_mla long total aperture
' t_mlp long total pincers
' t_mp position pincers
' t_mrot position angle rotation
' t_mlc contact point pincers

t_orient t_mrot
t_pen = 1
If t_mp > = (t_mla / 2) Then t_mp = (t_mla / 2)
' aqui creamos el cuerpo del manipulador
t_rt 90 : t_fd (t_mla / 2) + 10
t_rt 90 : t_fd t_mla / 2
t_rt 90 : t_fd t_mla + 20
t_rt 90 : t_fd t_mla / 2
t_rt 90 : t_fd (t_mla / 2) + 10
t_color = 15
' aqui creamos la parte giratoria
t_arc_cir ((t_mla / 2) + 10, 270, 90, t_mrot)
' aqui creamos el punto de rotacion
t_circle (5)
t_pen = 0
' aqui creamos y posicionamos las pinzas
t_rt 90 : t_fd (t_mla / 2)
't_color = 12
'color 12
t_lt 90 : t_fd t_mp ' posicion inicial "0" pinzas
' inicio pinza derecha
t_rt 90
t_pen = 1 : t_fd t_mlp : t_bk t_mlp : t_arc_ellip (10, t_mlp,90, 180, t_mrot+90)
' fin pinza derecha
' esto es la posicion de apertura cierre de las pinzas
t_pen = 0
'color 12
t_lt 90
't_bk 10
't_bk ((t_mp ) * 2) - 10
t_bk t_mp * 2
' inicio pinza izquierda
t_rt 90
t_pen = 1 : t_fd t_mlp : t_bk t_mlp : t_arc_ellip (10, t_mlp, 0, 90, t_mrot+90)
' fin pinza izquierda
t_pen = 0 : t_rt 270 : t_fd (t_mp) : t_rt 90
If t_mlc >= t_mlp Then t_mlc = t_mlp
If t_mlc <= 0 Then t_mlc = 0
t_fd t_mlc ' punto de contacto de las pinzas
t_pen = 1
End Sub
'end manipulator

Sub T_TELESCOPIC_CILINDER (T_DIAM_CIL As Double, T_LONG_TOTAL As Double, T_STEPS As Double, T_POSITION_STEP As Double, T_ROT_CIL As Double, T_RADIUS_ROT As Double)

Dim As Integer T_TOT_STEPS
Dim As Double T_LONG_STEP, T_RING, T_NTC

'T_DIAM_CIL = DIAMETER OF CILINDER
'T_LONG_TOTAL = LONG TOTAL
'T_STEPS = NUMBER OD STEPS
'T_POSITION = POSITION EXTREME CILINDER
'T_ROT_CIL = ANGLE OF ROTATION OF CILINDER
'T_RADIUS_ROT = POINT RADIUS ROTATION

t_position (220,140) : T_COLOR = 12
T_TOT_STEPS = T_STEPS + 1
T_RING = T_DIAM_CIL / 2 / T_STEPS
T_LONG_STEP = T_LONG_TOTAL / T_STEPS
If T_POSITION_STEP > T_LONG_STEP Then T_POSITION_STEP = T_LONG_STEP
If T_RADIUS_ROT > T_LONG_STEP Then T_RADIUS_ROT = T_LONG_STEP
t_orient T_ROT_CIL

'INIT PART RADIUS ROTATION
t_circle 5
T_PEN = 0 : t_fd -T_RADIUS_ROT
T_PEN = 1
t_axes
'INIT_PART
t_rt 90 : t_fd (T_RING * T_STEPS) : t_lt 90 : t_fd T_LONG_STEP : t_lt 90 : t_fd (T_RING * T_STEPS)*2
t_lt 90 : t_fd T_LONG_STEP : t_lt 90 : t_fd (T_RING * T_STEPS)
T_PEN = 0 : t_lt 90 : t_fd T_LONG_STEP
T_PEN = 1

'STEPS PARTS
For T_NTC = 1 To T_STEPS - 1
t_rt 90 : t_fd T_RING * (T_STEPS - T_NTC) : t_lt 90 : t_fd T_POSITION_STEP
t_lt 90 : t_fd T_RING * (T_STEPS - T_NTC)* 2 : t_lt 90 : t_fd T_POSITION_STEP
t_lt 90 : t_fd T_RING * (T_STEPS - T_NTC)
T_PEN = 0 : t_lt 90 : t_fd T_POSITION_STEP
T_PEN = 1
Next T_NTC
End Sub[/code]

Here my version of your garden machine. It now has one SIERRA subroutine. Save as “TES_GARDEN.BAS” or a other name you like.
[code file=TES_GARDEN.BAS]' will only work correctly with testudo#.bi

#Include "testudo1.bi"

Declare Sub sierra(offset As Double, col As UByte)
Declare Sub box

Dim Shared As Double kx1,ky1,kx2,ky2
Dim As Integer n
'Cls
Screen 12
t_init

For n = 0 To 3600
If Inkey <> "" Then End
ScreenLock
Cls
t_position (-122,160)
t_scale = 6
t_text_color = 15
t_text "garden machine"
t_scale = 4
t_position (-57,-45)
t_text "electric motor and mechanical movement"

t_scale = 1
box
t_orient n
t_position (114,0): t_color = 15 : t_star (25,30,25,n)' engranaje menor
t_circle (5)' eje engranaje menor
t_position (200,0): t_star (50,60,55,-n/2)' engranaje mayor
t_circle (5)' eje engranaje mayor

kx1 = (Cos(t_radians(-n))*25)
ky1 = -(Sin(t_radians(-n))*25)
Circle (kx1+520,ky1+240),23,12
Circle (kx1+520,ky1+240),5,12,,,,f
sierra(kx1, 12)

kx2 = (Cos(t_radians(-n+180))*25)
ky2 = -(Sin(t_radians(-n+180))*25)
Circle (kx2+520,ky2+240),23,14
Circle (kx2+520,ky2+240),5,14,,,,f
sierra(kx2, 14)

ScreenUnLock
Sleep 10
Next n
Sleep 3000
End


Sub sierra (offset As Double, col As UByte)
Dim s1 As Integer
t_orient 90 : t_position(200 + offset, 0)
t_pen = 0 : t_color = col : t_fd 25 '20
t_pen = 1 : t_arc_cir (25,0,180,0) ' t_arc_cir (25,180,360,0)
t_pen = 0 : t_rt 90 : t_fd 25 : t_rt 90 : Color col
t_pen = 1 : t_fd 50 ' 45
t_rt 90
t_pen = 0 : t_fd 25 : t_color = col
t_pen = 1 : t_arc_cir (25,180,360,0) ' t_arc_cir (25,0,180,0)
t_pen = 0 : t_fd 25 : t_rt 90
t_pen = 1 : t_fd 20 ' 15
t_lt 90 : t_fd 150
For s1 = 1 To 10
t_lt 80 : t_fd 20 : t_rt 160 : t_fd 20 : t_lt 80 : t_fd 20
Next s1
t_rt 90 : t_fd 10 : t_rt 90 : t_fd 20
For s1 = 1 To 10
t_lt 80 : t_fd 20 : t_rt 160 : t_fd 20 : t_lt 80 : t_fd 20
Next s1
t_fd 130 : t_lt 90 : t_fd 20 '15
End Sub

Sub box
t_bold = 1
t_thickness = 4
t_color = 2
t_position (200,0) : t_arc_ellip (130,70,180,270,0)
t_position (200,0) : t_arc_cir (70,270,360,0)
t_position (200,0) : t_arc_cir (70,0,90,0)
t_position (200,0) : t_arc_ellip (130,70,90,180,0)
t_bold = 0
End Sub
[/code]

My version of your safe lock. Look for your self to find out what I have done to it. Save as “TES_SAFELOCK.BAS” or a other name you like.
[code file=TES_SAFELOCK.BAS]' will only work correctly with testudo#.bi

#Include "testudo1.bi"

Sub gear (ang_rot As Double)
Dim As Integer c, n
Dim As Double x,x1,y,y1

't_position (0,0)
t_color = 15

t_rt ANG_ROT
For N = 1 To 8
t_position (0,0) : t_fd 15 : t_rt 45
Next N
t_position (0,0)
t_color = 12
t_circle 15

For n = ang_rot To 360+ang_rot Step 30
x = Cos (t_radians (n)) *38.1970
y = -Sin (t_radians (n)) *38.1970

t_position (x,y)

If (c And 1)= 0 Then
t_arc_cir (10,90,270,-n)
Else
t_arc_cir (10,-90,90,-n)
End If

c = c + 1
Next n
t_orient 90
t_color = 15
End Sub

'-=-=-=-=-=-=-=-=-=-=-=-=-=-
' MAIN
'-=-=-=-=-=-=-=-=-=-=-=-=-=-

Dim As Double x, y, rd, di, x1, y1, nd, nd1
Dim As Integer c, c1, k, n

Screen 12
t_init
T_BOLD = 1
T_THICKNESS = 1
T_HOLE = 0
'gear 0

'POSICION SALIENDO
For k = 1 To 10
For nd1 = -50 To 50
If Inkey <> "" Then End
nd = 50 - Abs(nd1)
Cls
ScreenLock
t_orient 90
T_COLOR = 6
t_position (90,130) : t_gt (-135,130) : t_gt (-135,-130) : t_gt (90,-130) : t_gt (90,130) 'BOX
T_COLOR = 15
t_position (-nd,0) : t_arc_cir (65,120,218,22) 'ARCO DE CIERRE INTERNO

'pivote superior
T_COLOR = 2
't_orient 90
't_home
t_position (-43,60+(nd*0.7))
t_fd 100
t_rt 90
t_fd 30
t_rt 90
t_fd 77
t_rt 55.5376
t_fd 35
'pivote inferior
t_orient 270
't_home
t_position (-43,-(58+(nd*0.7)))
t_fd 100
t_lt 90
t_fd 30
t_lt 90
t_fd 77
t_lt 55.5376
t_fd 35
'guia SUPERIOR
'Color 14
t_color = 14
t_position (15,70) : t_circle (5)
t_position (16-nd,70) : t_arc_cir (5,90,270,0)
t_position (66-nd,70) : t_arc_cir (5,90,270,180)
t_orient 0:t_position (16-nd,75) : t_fd 50
't_orient 0
t_position (16-nd,65) : t_fd 50
'GUIA INFERIOR
t_position (15,-70) : t_circle (5)
t_position (16-nd,-70) : t_arc_cir (5,90,270,0)
t_position (66-nd,-70) : t_arc_cir (5,90,270,180)
t_orient 0 : t_position (16-nd,-75) : t_fd 50
't_orient 0
t_position (16-nd,-65) : t_fd 50
'T_color = 15
gear (-nd * 1.5)
t_position (-nd,-40)

'CREMALLER
For n = 0 To 100 Step 40
t_position (n-41-nd,40):t_arc_cir (10,0,180,0)
t_position (n-21-nd,40):t_arc_cir (10,0,180,180)
Next n

t_lt 270
t_pen = 0 : t_fd 10
t_pen = 1 : t_fd 10 : t_lt 90 : t_fd 50 : t_lt 90 : t_fd 20
't_pen = 0
t_lt 90
't_fd 30
't_bk 30
't_pen = 1
t_bk 30 : t_rt 90 : t_fd 20 : t_lt 35.5376 : t_fd 101.0232 : t_rt 125.5376
t_fd 30 : t_lt 90 : t_fd 90 : t_lt 90 : t_fd 30
'PIVOTES HORIZONTALES
For n = 1 To 3
t_lt 90 : t_fd 50 : t_rt 90 : t_fd 20
t_rt 90 : t_fd 50 : t_lt 90 : t_fd 30
Next n
t_lt 90 : t_fd 90 : t_lt 90 : t_fd 30 : t_rt 125.5376 : t_fd 101.0232 : t_lt 35.5376
t_fd 20 : t_lt 90 : t_fd 30 : t_rt 90 : t_fd 20 : t_lt 90 : t_fd 30 : t_lt 90 : t_fd 110
If K < 5 Then Line (185,110)-(410,370),15,BF
ScreenUnLock
Sleep 50
Next nd1
Next K
'Cls
Sleep 3000
End[/code]


My version of your bottle in the sea. Check out how I handle the angle of the bottle (under 'bottle).Save as “TES_BOTTLE.BAS” or a other name you like.
[code file=TES_BOTTLE.BAS]' will only work correctly with testudo#.bi

#Include "testudo1.bi"

Declare Sub bottle (g As Double)

Dim Shared As Integer a
Dim As Integer b,h,x,z
Dim c As Double

Cls
Screen 12
t_init
z = -45
x = 1
t_bold = 1
t_thickness = 2

For a = 1 To 10000 Step 20
If Inkey <> "" Then End
ScreenLock
Cls
c = Sin(t_radians(a))*10

'bottle
z = z + x
If z >= 45 Or z <= -45 Then x = -x
t_position ((a/-100),-c)
bottle (z)

'ball
Circle (640-(a/10),(c+240)),40,12,,,,f

'sea
For b = a To 640 + a
c = (Sin(t_radians(b))*10)+240
Circle (b-a,c),2,9,,,,f
Next b
ScreenUnLock
Sleep 100,0

Next a
'Print "end"
t_scale = 4
t_text_bold = 1
t_text_thickness = 2
t_position (-20,40) : t_text("THE END")
Sleep 3000
End


Sub bottle (g As Double)

t_scale = 1 + (a/2000) : t_color = 15
t_pen = 0 : t_orient 270 '180
t_lt g : t_fd 42 : t_lt 90
t_pen = 1 : t_fd 8
t_pen = 0 : t_lt 90 : t_fd 8
t_pen = 1 : t_arc_cir (8,270,360,g) '(8,0,90,-g)
t_pen = 0 : t_rt 90 : t_fd 8 : t_lt 90
t_pen = 1 : t_fd 40
t_pen = 0 : t_lt 90 : t_fd 8
t_pen = 1 : t_arc_cir (8,0,90,g) '(8,270,360,-g)
t_pen = 0 : t_rt 90 : t_fd 12
t_pen = 1 : t_arc_cir (4,180,270,g) '(4,90,180,-g)
t_pen = 0 : t_lt 90 : t_fd 4 : t_rt 90
t_pen = 1 : t_fd 10 : t_rt 90 : t_fd 2 : t_lt 90 : t_fd 2 : t_lt 90 : t_fd 12 'boca botella
t_lt 90 : t_fd 2 : t_lt 90 : t_fd 2 : t_rt 90 : t_fd 10
t_pen = 0 : t_rt 90 : t_fd 4
t_pen = 1 : t_arc_cir (4,270,360,g) '(4,0,90,-g)
t_pen = 0 : t_lt 90 : t_fd 12
t_pen = 1 : t_arc_cir (8,90,180,g) '(8,180,270,-g)
t_pen = 0 : t_rt 90 : t_fd 8 : t_lt 90
t_pen = 1 : t_fd 40
t_pen = 0 : t_lt 90 : t_fd 8
t_pen = 1 : t_arc_cir (8,180,270,g) '(8,90,180,-g)
t_pen = 0 : t_rt 90 : t_fd 8 : t_lt 90
t_pen = 1 : t_fd 8
End Sub[/code]

Here is my version of your train on a bridge. I have altered the spacing of the columns under the bridge and add a few vertical beams the make the bridge somewhat more structural save. Still needs a locomotive at the back to make it look more real. Save as “TES_TRAIN” or a other name you like.
[code file=TES_TRAIN]' will only work correctly with testudo#.bi

#Include "testudo1.bi"
Declare Sub EXTRUCTURA ()
Declare Sub IMAGEN_FIJA ()

Dim N2 As Double
Dim As Integer C, J, V, VA, r
Dim Shared As Integer n

Screen 12
Palette 2, 100, 150, 100

t_init
IMAGEN_FIJA
EXTRUCTURA
T_THICKNESS = 1
C = 200 'PASO / VELOCIDAD / SPEED: Km/Hor or Mill/Hor <<<<<<<<<!!!!!!!!!!!
VA = 20 ' VAGONES / Wagons <<<<<<<<<<<<<<!!!!!!!!!!!!!!!!!!
V = 300*(VA+1)
J = C
'AQUI DIBUJAMOS LA MAQUINA DEL TREN
T_COLOR = 15

'MAQUINA/LOCOMOTORA
For N2 = 400 To -V Step -C

If Inkey <> "" Then End
R = N2
ScreenLock
Line (640-J,168)-(640,235),0,BF 'BORRAR PASO DEL TREN
t_position (R,38) : T_COLOR = 10 : t_arc_ellip (90,30,90,180,0)'CAVINA PARTE SUPERIOR
T_COLOR = 15
t_position (R -90,68) : t_arc_ellip (90,30,270,360,0) 'CAVINA PARTE INFERIOR
t_position (R -70,38) : t_arc_cir (20,180,270,0)
T_COLOR = 6
t_position (R -40,18) : t_arc_cir (10,180,360,0)'RUEDA 1 DELANTERA
t_position (R -15,18) : t_arc_cir (10,180,360,0)'RUEDA 2 DELANTERA
t_position (R + 65,18) : t_arc_cir (10,180,360,0)'RUEDA 3 TRASERA
t_position (R + 90,18) : t_arc_cir (10,180,360,0)'RUEDA 4 TRASERA
T_COLOR = 15
t_position (R -70,18) : t_gt (R + 120,18)
t_position (R + 120,38) : t_arc_cir (20,270,360,0)
t_position (R + 140,38) : t_fd 10
t_position (R + 120,48) : t_arc_cir (20,0,90,0)
t_position (R + 120,68) : t_lt 90 : t_fd 120
t_position (R + 100,48) : T_COLOR = 14 : t_ellipse (20,10,0)'VENTANA VENTILACION SALA MAQUINAS
T_PEN = 0 : t_lt 90 : t_fd 30 : t_lt 90 : t_fd 40

'VAGONES
For R = 1 To VA
T_COLOR = 15
T_PEN = 0 : t_fd 23 : t_lt 90 : t_fd 20 : T_PEN = 1 : t_arc_cir (20,180,270,0)
T_PEN = 0 : t_lt 90 : t_fd 20 : t_rt 90 : T_PEN = 1 : t_fd 10
T_PEN = 0 : t_rt 90 : t_fd 20 : T_PEN = 1 : t_arc_cir (20,90,180,0)
T_PEN = 0 : t_lt 90 : t_fd 20 : t_rt 90 : T_PEN = 1 : t_fd 200
T_PEN = 0 : t_rt 90 : t_fd 20 : T_PEN = 1 : t_arc_cir (20,0,90,0)
T_PEN = 0 : t_lt 90 : t_fd 20 : t_rt 90 : T_PEN = 1 : t_fd 10
T_PEN = 0 : t_rt 90 : t_fd 20 : T_PEN = 1 : t_arc_cir (20,270,360,0)
T_PEN = 0 : t_lt 90 : t_fd 20 : t_rt 90 : T_PEN = 1 : t_fd 200
T_COLOR = 6
T_PEN = 0 : t_rt 180 : t_fd 30 : T_PEN = 1 : t_arc_cir (10,180,360,0)'RUEDA 1 DELANTERA VAGON
T_PEN = 0 : t_fd 25 : T_PEN = 1 : t_arc_cir (10,180,360,0)'RUEDA 2 DELANTERA VAGON
T_PEN = 0 : t_fd 95 : T_PEN = 1 : t_arc_cir (10,180,360,0)' RUEDA 3 TRASE VAGON
T_PEN = 0 : t_fd 25 : T_PEN = 1 : t_arc_cir (10,180,360,0)' RUEDA 4 TRASE VAGON
t_color = 15 : t_fd 20 : t_bk 180 : t_fd 160 ' remove the end's of the wheel arc's
T_COLOR = 14
T_PEN = 0 : t_lt 90 : t_fd 25 : T_PEN = 1 : t_ellipse (20,10,0)' VENTANA 4 VAGON
T_PEN = 0 : t_lt 90 : t_fd 50 : T_PEN = 1 : t_ellipse (20,10,0)' VENTANA 3 VAGON
T_PEN = 0 : t_fd 50 : T_PEN = 1 : t_ellipse (20,10,0)' VENTANA 2 VAGON
T_PEN = 0 : t_fd 50 : T_PEN = 1 : t_ellipse (20,10,0)' VENTANA 1 VAGON
T_PEN = 0 : t_lt 90 : t_fd 25 : t_lt 90 : t_fd 195
Next R
t_pen = 1
EXTRUCTURA
ScreenUnLock
Sleep 50
J = J + C
Next N2
Color 15
Print " END"
Sleep 3000
End

Sub EXTRUCTURA ()
t_orient 90
T_COLOR = 2
T_BOLD = 1
T_HOLE = 0 '6
t_position (-320,5) : t_gt (320,5) ' PRIMER NIVEL
t_position (-320,75) : t_gt (320,75) ' SEGUNDO NIVEL
T_THICKNESS = 1
t_position (-320,99) : t_gt (320,99) ' TERCER NIVEL
'AQUI DIBUJAMOS LA EXTRUCTURA DEL TREN
T_THICKNESS = 2
t_position (-320,40) : t_rt 90 : t_spring (10,45,50)
t_position (-320,40) : t_spring (10,-45,50)
For N = -284 To 284 Step 71 'some extra support
t_position (N,5) : t_gt (N,75) 'divides the squares
Next N 'into triangles
t_orient 90
End Sub

Sub IMAGEN_FIJA ()
T_COLOR = 2
T_BOLD = 1

'AQUI DIBUJAMOS LOS ARCOS DEL PUENTE
T_THICKNESS = 3
For N = -420 To 420 Step 210
t_position (N,-241)
t_arc_ellip (95, 240, 0,180,0)
t_arc_ellip (125, 240, 0,180,0)
t_arc_ellip (110, 240, 0,180,0)
Next N

Line (0,400)-(640,480),1,BF 'AGUA

'AQUI DIBUJAMOS LA EXTRUCTURA DE LA CARRETERA
T_THICKNESS = 1
't_rt 0
t_position (-320,88) : t_spring (30,45,15)
t_position (-320,88) : t_spring (30,-45,15)
'AQUI DIBUJAMOS LAS FAROLAS
For N = -318 To 318 Step 106
t_position (N,75) : T_COLOR = 2 : t_gt (N,125)
t_position (N,130) : T_COLOR = 14 : t_circle (5)
Next N

t_orient 0
End Sub[/code][/size]
Last edited by frisian on Dec 18, 2013 21:42, edited 3 times in total.
frisian
Posts: 231
Joined: Oct 08, 2009 17:25

Re: Library for drawing turtle type (Logo turtle)

Postby frisian » Nov 17, 2013 16:48

Rest of previous posting. Had to separate it from my other posting went over the 60000 character limit.

The incude file "testudo1.bi" is in the posting above this one.

Her is the altered version of your robot. I have placed the line that draws the placed circles in a macro for easy editing and added a line that checks for a key pressed in case the user wants to stop the program. t_mxxx and t_myyy are redundant. Save as “TES_ROBOT.BAS” or a other name you like.
[code file=TES_ROBOT.BAS]' will only work correctly with testudo#.bi

#Include "testudo1.bi"

#Macro place_obj ()
If Inkey <> "" Then End
For k = 0 To j
If z(k,1) = 0 And z(k,2) = 0 Then Exit for
t_position (z(k,1),-z(k,2))
t_circle 10
Next k
#EndMacro

Dim As Double z(0 To 6, 2),
Dim As Integer espera, j, k, nr

'cls
Screen 12
t_init

t_bold = 1 ' modificate >>> 0
t_thickness = 1 ' modificate >>> 0

espera = 1 ' Modificate espera >>> 0.01 and .... see speed!!!

For j = 0 To 6
If Inkey <> "" Then end
For nr = 0 To 100
ScreenLock
Cls
place_obj ()
t_position (0, -180)
t_circle 10
t_position (0, 0)
t_cilinder (270, 0, 50, 100, nr, 30)
t_manipulator (30, 40, nr, 90, 30)
ScreenUnLock
Sleep espera
Next nr

' cierra la pinza
ScreenLock
Cls
place_obj ()
t_position (0, -180)
t_circle 10
t_position (0, 0)
t_cilinder (270, 0, 50, 100, 100, 30)
t_manipulator (30, 40, 10, 90, 30)
ScreenUnLock

' entra el cilindro
For nr = 100 To 0 Step - 1
ScreenLock
Cls
place_obj ()
t_position (0, 0)
t_cilinder (270, 0, 50, 100, nr, 30)
t_manipulator (30, 40, 10, 90, 30)
t_circle 10
ScreenUnLock
Sleep espera
Next nr

' rota el cilindro
For nr = 0 To 180 + (j * 30)
ScreenLock
Cls
place_obj ()
t_position (0, 0)
t_cilinder (270 - nr, 0, 50, 100, nr, 30)
t_manipulator (30, 40, 10, 90 - nr, 30)
t_circle 10
ScreenUnLock
Sleep espera
Next nr

' abre la pinza
Cls
ScreenLock
place_obj ()
t_position (0, 0)
t_cilinder (90 - (j * 30), 0, 50, 100, 100, 30)
t_manipulator (30, 40, 30, 270 - (j * 30), 30)
t_circle 10
ScreenUnLock
z(j,1) = t_position_x - t_center_screen_x
z(j,2) = t_position_y - t_center_screen_y

' entra el cilindro
For nr = 100 To 0 Step -1
ScreenLock
Cls
place_obj ()
t_position (0, 0)
t_cilinder (90 - (j * 30), 0, 50, 100, nr, 30)
t_manipulator (30, 40, 30, 270 - (j * 30), 30)
ScreenUnLock
Sleep espera
Next nr

For nr = 90 + (j * 30) To 270
ScreenLock
Cls
place_obj ()
t_position (0, 0)
t_cilinder (180 - nr, 0, 50, 100, 0, 30)
t_manipulator (30, 40, 0, -nr, 30)
ScreenUnLock
Sleep espera
Next nr
Next j

Sleep 3000

End[/code]
Last edited by frisian on Dec 18, 2013 21:43, edited 3 times in total.
lrcvs
Posts: 555
Joined: Mar 06, 2008 19:27
Location: Spain

Re: Library for drawing turtle type (Logo turtle)

Postby lrcvs » Nov 18, 2013 19:55

Hi, frisian:

You're doing a great, great, great, job.!

The examples work fine.

The train example does not work well, I guess this is not adapted to your program.

Study your version, there are ideas that are very interesting.!

regards
frisian
Posts: 231
Joined: Oct 08, 2009 17:25

Re: Library for drawing turtle type (Logo turtle)

Postby frisian » Nov 18, 2013 21:34

lrcvs wrote:The train example does not work well, I guess this is not adapted to your program

I altered some things like the color of the bridge and the placement of the pillars, but it should work fine.
Can you tell me whats wrong in your opinion.
lrcvs
Posts: 555
Joined: Mar 06, 2008 19:27
Location: Spain

Re: Library for drawing turtle type (Logo turtle)

Postby lrcvs » Nov 18, 2013 22:10

Hi, fisian:

With your version, I tried:

The garden machine = good
The bottle = good
The security lock = good

The train = Not working

Regards
frisian
Posts: 231
Joined: Oct 08, 2009 17:25

Re: Library for drawing turtle type (Logo turtle)

Postby frisian » Nov 19, 2013 10:00

lrcvs

I have copied the train example from the forum and run it on my computer, it runs fine.
The copy on the forum is also identical to the copy on my hard drive

Have you tried copying it again from the forum posting.
Can you describe what is wrong.
Will it compile, if not what is the error message
If it runs, does it stop or are the graphics messed up.

You need to be more detailed
The train = Not working
gives me no clue about what could be wrong with it.
lrcvs
Posts: 555
Joined: Mar 06, 2008 19:27
Location: Spain

Re: Library for drawing turtle type (Logo turtle)

Postby lrcvs » Nov 19, 2013 18:54

Hi, frisian:

Sorry!

Yes, working good.!

I must have copied wrong from my listing with your version and examples.

The color "cyan" of the structure has been very good, Ok!

Great job and good ideas.!
lrcvs
Posts: 555
Joined: Mar 06, 2008 19:27
Location: Spain

New Turtle_8 (Prototipe)

Postby lrcvs » Oct 17, 2015 18:27

Hi:

Turtle 8 (Basica/Low Level)
Is the new prototype FreeBasic Turtle.
Important points:
This version (Turtle_8) is incompatible with previous versions of FreeBasic Turtle.
This prototype has no text and no preinstalled figures.
Some previous options have been improved.
I have also made a clean code, simplifying the program as possible.
Has new graphical features, the most important, it is that you can draw using frames (patterns), getting more interesting patterns and shapes, photos, colors (rgb color)....
In the following days, I'll upload some examples.
I wish you interesting Have fun.
Admit any opinion or suggestion!

Code: Select all

'Turtle 8 basica'
'lrcvs 17.Oct.15'

declare function t_ang (byval t_x1 as double, byval t_y1 as double, byval t_x2 as double,byval t_y2 as double) as double
declare function t_apothem (byval t_numsides as integer, byval t_radius as double) as double
declare function t_degrees (byval t_rad as double) as double
declare function t_long (byval t_x1 as double, byval t_y1 as double, byval t_x2 as double, byval t_y2 as double) as double
declare function t_radians (byval t_angle as double) as double
declare function t_side (byval t_position_x as double, byval t_position_y as double, byval t_radius as double,  byval t_numsides as integer) as double

declare sub t_active_pattern_off ()
declare sub t_active_pattern_on ()
declare sub t_active_primary_off ()
declare sub t_active_primary_on ()
declare sub t_active_secondary_off ()
declare sub t_active_secondary_on ()
declare sub t_bk (byval t_distance as double)
declare sub t_color (byval t_ink as integer )
declare sub t_fd (byval t_distance as double)
declare sub t_gt (byval t_position_x as double, byval t_position_y as double)
declare sub t_home
declare sub t_init ()
declare sub t_init_style_line ()
declare sub t_init_pattern ()
declare sub t_lt (byval t_angle as double)
declare sub t_orient_l (byval t_angle as double)
declare sub t_orient_r (byval t_angle as double)
declare sub t_pattern_color (byval t_distance as double)
declare sub t_photo ()
declare sub t_pos (byval t_position_x as double, byval t_position_x as double)
declare sub t_pos_rot_xy(byval t_pos_rot_x as double, byval t_pos_rot_y as double)
declare sub t_rot_l (byval t_distance as double,byval t_angle as double)
declare sub t_rot_r (byval t_distance as double,byval t_angle as double)
declare sub t_rt (byval t_angle as double)
declare sub t_style_line_off ()
declare sub t_style_line_on ()
declare sub t_turtle_off ()
declare sub t_turtle_on ()

dim shared as integer t_active_pattern , t_active_primary , t_active_secondary , t_c1 , t_c2 , t_c3 , t_center_screen_x , t_center_screen_y , t_h , t_inverse_pattern , t_style_line , t_turtle , t_w

dim shared as double t_angle , t_distance , t_heading , t_new_position_x , t_new_position_y , t_pc , t_pos_rot_x , t_pos_rot_y , t_po_ro_x , t_po_ro_y ,t_pos_x , t_pos_y , t_position_x , t_position_y , t_radio , t_scale , t_thick

dim shared as string t_model

':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'A/a = 1   F/f = 6    K/k = 11    P/p = 16    V/v = 21
'B/b = 2   G/g = 7    L/l = 12    Q/q = 17    W/w = 22
'C/c = 3   H/h = 8    M/m = 13    R/r = 18    X/x = 23
'D/d = 4   I/i = 9    N/n = 14    T/t = 19    Y/y = 24
'E/e = 5   J/j = 10   O/o = 15    U/u = 20    Z/z = 25
'Uppers = On/1, Lowers = Off/0

dim shared as string t_pattern (19)
t_pattern (1) =  "A"        :   t_pattern (10) =  "Fc"
t_pattern (2) =  "Aa"       :   t_pattern (11) =  "FcAc"
t_pattern (3) =  "Bb"       :   t_pattern (12) =  "FcAcAc"
t_pattern (4) =  "Cc"       :   t_pattern (13) =  "FcAcAcAc"
t_pattern (5) =  "Ee"       :   t_pattern (14) =  "FcFcAc"
t_pattern (6) =  "Ff"       :   t_pattern (15) =  "FcFcAcAc"
t_pattern (7) =  "CcAc"     :   t_pattern (16) =  "FcFcAcAcAc"
t_pattern (8) =  "CcAcAc"   :   t_pattern (17) =  "FcFcFcAc"
t_pattern (9) =  "CcAcAcAc" :   t_pattern (18) =  "FcFcFcAcAc"
t_pattern (19) =  "LfLfLfAfAfAf"
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Colors Basics t_color, see sub t_color
'8  Black    10 Blue    12 Brown     79 Fuchsia  51 Green     50 Grey
'57 Ivory    76 Lime    95 Navy      97 Olive    99  Orange  109 Pink 112 Purple
'113 Red    122 Silver 123 Sky Blue 134 Violet  136 White    138 Yellow
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function t_ang (byval t_x1 as double, byval t_y1 as double, byval t_x2 as double, byval t_y2 as double) as double
   dim as double t_fang
   if t_x1 < t_x2 and t_y1 < t_y2 then t_fang = t_degrees(acos((t_x2 - t_x1)/sqr (((t_x2 - t_x1)^2) + ((t_y2 - t_y1)^2))))
   if t_x1 > t_x2 and t_y1 < t_y2 then t_fang = t_degrees(acos((t_x2 - t_x1)/sqr (((t_x2 - t_x1)^2) + ((t_y2 - t_y1)^2))))
   if t_x1 > t_x2 and t_y1 > t_y2 then t_fang = 360 - (t_degrees(acos((t_x2 - t_x1)/sqr (((t_x2 - t_x1)^2) + ((t_y2 - t_y1)^2)))))
   if t_x1 < t_x2 and t_y1 > t_y2 then t_fang = 360 - (t_degrees(acos((t_x2 - t_x1)/sqr (((t_x2 - t_x1)^2) + ((t_y2 - t_y1)^2)))))
   if t_x1 < t_x2 and t_y1 = t_y2 then t_fang = 0
   if t_x1 = t_x2 and t_y1 < t_y2 then t_fang = 90
   if t_x1 > t_x2 and t_y1 = t_y2 then t_fang = 180
   if t_x1 = t_x2 and t_y2 < t_y1 then t_fang = 270
   t_ang = t_fang
end function

function t_apothem (byval t_numsides as integer, byval t_radius as double) as double
   t_apothem = (cos(t_radians((360/t_numsides)/2)) * t_radius)
end function

function t_degrees (byval t_rad as double) as double
   t_degrees = (t_rad * 57.295779513082320876798154814105)
end function

function t_long (byval t_x1 as double, byval t_y1 as double, byval t_x2 as double, byval t_y2 as double) as double
   t_long = sqr(abs((t_x1 - t_x2)^2) + abs((t_y1 - t_y2)^2))
end function

function t_radians (byval t_angle as double) as double
   t_radians  =  (t_angle * 0.01745329251994329576923690768489 )
end function

function t_side (byval t_position_x as double, byval t_position_y as double, byval t_radius as double,  byval t_numsides as integer) as double
   dim as double t_rgrad, t_x0, t_y0, t_x1, t_y1
   t_rgrad = t_radians(0)
   t_x0 = (t_radius * cos (t_rgrad)) + t_position_x
   t_y0 = (t_radius * sin (t_rgrad)) + t_position_y
   t_rgrad = t_radians(360 / t_numsides)
   t_x1 = (t_radius * cos (t_rgrad)) + t_position_x
   t_y1 = (t_radius * sin (t_rgrad)) + t_position_y
   t_side= t_long (t_x0, t_y0, t_x1, t_y1)
end function

sub t_active_pattern_off
   t_active_pattern = 0
end sub

sub t_active_pattern_on
   t_active_pattern = 1
end sub

sub t_active_primary_off
   t_active_primary = 0
end sub

sub t_active_primary_on
   t_active_primary = 1
end sub

sub t_active_secondary_off
   t_active_secondary = 0
end sub

sub t_active_secondary_on
   t_active_secondary = 1
end sub

sub t_bk (byval t_distance as double)
   dim as integer t_a, t_vm, t_dist
    dim as double t_x2, t_y2, t_x3, t_y3

   if t_turtle = 0 then
      t_new_position_x = t_position_x - ((t_distance * t_scale) * cos(t_heading))
      t_new_position_y = t_position_y + ((t_distance * t_scale) * sin(t_heading))
      t_position_x = t_new_position_x
      t_position_y = t_new_position_y
   end if
   if t_turtle = 1 and t_style_line = 0 then
      t_new_position_x = t_position_x - ((t_distance * t_scale) * cos(t_heading))
      t_new_position_y = t_position_y + ((t_distance * t_scale) * sin(t_heading))
      line (t_position_x, t_position_y)-(t_new_position_x, t_new_position_y)
      t_position_x = t_new_position_x
      t_position_y = t_new_position_y
   end if
   if t_turtle = 1 and t_style_line = 1 then
t_a = len(t_model)
for  t_dist =   1  to  t_distance
            t_vm = (asc (mid(t_model,t_c1, 1)))
               if  t_vm > 64  and t_vm < 91 then
                            t_x2 = t_position_x - ((t_dist* t_scale) * cos(t_heading))
                            t_y2 = t_position_y + ((t_dist* t_scale) * sin(t_heading))
                            if t_thick = 0 then
                                pset (t_x2, t_y2)
                                else
                                circle (t_x2, t_y2), t_thick,,,,,f
                            end if
                            t_c2 = t_c2 + 1
                            if t_c2 > (t_vm -64) then t_c2 =  1 : t_c1 = t_c1 +1
                            if t_c1 >  t_a then t_c1 =1
                end if
               
                if  t_vm > 96 and t_vm < 123  then
                           t_x3 = t_position_x - ((t_dist* t_scale) * cos(t_heading))
                           t_y3 = t_position_y + ((t_dist* t_scale) * sin(t_heading))
                                if t_thick = 0 then
                                    'pset (t_x3, t_y3)
                                else
                                    'circle (t_x3, t_y3), t_thick,,,,,f
                                end if
                           t_c3 = t_c3 + 1
                           if t_c3 > (t_vm -96) then t_c3 =  1 : t_c1 = t_c1 +1
                           if t_c1 >  t_a then t_c1 =1
                end if
        next t_dist
t_position_x =  t_position_x + ((t_distance * t_scale) * cos(t_heading))
t_position_y =  t_position_y - ((t_distance * t_scale) * sin(t_heading))
end If

end sub

sub t_color (byval t_ink as integer)
   if t_ink = 1  then color rgb (240,248,255)  'alice blue
   if t_ink = 2  then color rgb (250,235,215)  'antique white
   if t_ink = 3  then color rgb (0,255,255)    'aqua
   if t_ink = 4  then color rgb (127,255,212)  'aqua marine
   if t_ink = 5  then color rgb (240,255,255)  'azure
   if t_ink = 6  then color rgb (245,245,220)  'beige
   if t_ink = 7  then color rgb (255,228,196)  'bisque
   if t_ink = 8  then color rgb (0,0,0)        'black
   if t_ink = 9  then color rgb (255,235,205)  'blanched almond
   if t_ink = 10 then color rgb (0,0,255)      'blue
   if t_ink = 11 then color rgb (138,43,226)   'blue violet
   if t_ink = 12 then color rgb (165,42,42)    'brown
   if t_ink = 13 then color rgb (222,184,135)  'burly wood
   if t_ink = 14 then color rgb (95,158,160)   'cadet blue
   if t_ink = 15 then color rgb (127,255,0)    'chart reuse
   if t_ink = 16 then color rgb (210,105,30)   'chocolate
   if t_ink = 17 then color rgb (255,127,80)   'coral
   if t_ink = 18 then color rgb (100,149,237)  'corn flower blue
   if t_ink = 19 then color rgb (255,248,220)  'corn silk
   if t_ink = 20 then color rgb (220,20,60)    'crimson
   if t_ink = 21 then color rgb (0,255,255)    'cyan
   if t_ink = 22 then color rgb (0,0,139)      'dark blue
   if t_ink = 23 then color rgb (0,139,139)    'dark cyan
   if t_ink = 24 then color rgb (184,134,11)   'dark golden rod
   if t_ink = 25 then color rgb (169,169,169)  'dark gray / dark grey
   if t_ink = 26 then color rgb (0,100,0)      'dark green
   if t_ink = 27 then color rgb (189,183,107)  'dark khaki
   if t_ink = 28 then color rgb (139,0,139)    'dark magenta
   if t_ink = 29 then color rgb (85,107,47)    'dark olive green
   if t_ink = 30 then color rgb (255,140,0)    'dark orange
   if t_ink = 31 then color rgb (153,50,204)   'dark orchid
   if t_ink = 32 then color rgb (139,0,0)      'dark red
   if t_ink = 33 then color rgb (233,150,122)  'dark salmon
   if t_ink = 34 then color rgb (143,188,143)  'dark sea green
   if t_ink = 35 then color rgb (72,61,139)    'dark slate blue
   if t_ink = 36 then color rgb (47,79,79)     'dark slate gray
   if t_ink = 37 then color rgb (0,206,209)    'dark turquoise
   if t_ink = 38 then color rgb (148,0,211)    'dark violet
   if t_ink = 39 then color rgb (255,20,147)   'deep pink
   if t_ink = 40 then color rgb (0,191,255)    'deep sky blue
   if t_ink = 41 then color rgb (105,105,105)  'dim gray / dim grey
   if t_ink = 42 then color rgb (30,144,255)   'dodger blue
   if t_ink = 43 then color rgb (178,34,34)    'firebrick
   if t_ink = 44 then color rgb (255,250,240)  'floral white
   if t_ink = 45 then color rgb (34,139,34)    'forest green
   if t_ink = 46 then color rgb (220,220,220)  'gainsboro
   if t_ink = 47 then color rgb (248,248,255)  'ghost white
   if t_ink = 48 then color rgb (255,215,0)    'gold
   if t_ink = 49 then color rgb (218,165,32)   'golden rod
   if t_ink = 50 then color rgb (128,128,128)  'gray
   if t_ink = 51 then color rgb (0,128,0)      'green
   if t_ink = 52 then color rgb (173,255,47)   'green yellow
   if t_ink = 53 then color rgb (240,255,240)  'honeydew
   if t_ink = 54 then color rgb (255,105,180)  'hot pink
   if t_ink = 55 then color rgb (205,92,92)    'indian red
   if t_ink = 56 then color rgb (75,0,130)     'indigo
   if t_ink = 57 then color rgb (255,255,240)  'ivory
   if t_ink = 58 then color rgb (240,230,140)  'khaki
   if t_ink = 59 then color rgb (230,230,250)  'lavender
   if t_ink = 60 then color rgb (255,240,245)  'lavender blush
   if t_ink = 61 then color rgb (124,252,0)    'lawn green
   if t_ink = 62 then color rgb (255,250,205)  'lemon chiffon
   if t_ink = 63 then color rgb (173,216,230)  'light blue
   if t_ink = 64 then color rgb (240,128,128)  'light coral
   if t_ink = 65 then color rgb (224,255,255)  'light cyan
   if t_ink = 66 then color rgb (250,250,210)  'light golden rod yellow
   if t_ink = 67 then color rgb (211,211,211)  'light gray / light grey
   if t_ink = 68 then color rgb (144,238,144)  'light green
   if t_ink = 69 then color rgb (255,182,193)  'light pink
   if t_ink = 70 then color rgb (255,160,122)  'light salmon
   if t_ink = 71 then color rgb (32,178,170)   'light sea green
   if t_ink = 72 then color rgb (135,206,250)  'light sky blue
   if t_ink = 73 then color rgb (119,136,153)  'light slate gray
   if t_ink = 74 then color rgb (176,196,222)  'light steel blue
   if t_ink = 75 then color rgb (255,255,224)  'light yellow
   if t_ink = 76 then color rgb (0,255,0)      'lime
   if t_ink = 77 then color rgb (50,205,50)    'lime green
   if t_ink = 78 then color rgb (250,240,230)  'linen
   if t_ink = 79 then color rgb (255,0,255)    'magenta / fuchsia
   if t_ink = 80 then color rgb (128,0,0)      'maroon
   if t_ink = 81 then color rgb (102,205,170)  'medium aqua marine
   if t_ink = 82 then color rgb (0,0,205)      'medium blue
   if t_ink = 83 then color rgb (186,85,211)   'medium orchid
   if t_ink = 84 then color rgb (147,112,219)  'medium purple
   if t_ink = 85 then color rgb (60,179,113)   'medium sea green
   if t_ink = 86 then color rgb (123,104,238)  'medium slate blue
   if t_ink = 87 then color rgb (0,250,154)    'medium spring green
   if t_ink = 88 then color rgb (72,209,204)   'medium turquoise
   if t_ink = 89 then color rgb (199,21,133)   'medium violet red
   if t_ink = 90 then color rgb (25,25,112)    'midnight blue
   if t_ink = 91 then color rgb (245,255,250)  'mint cream
   if t_ink = 92 then color rgb (255,228,225)  'misty rose
   if t_ink = 93 then color rgb (255,228,181)  'moccasin
   if t_ink = 94 then color rgb (255,222,173)  'navajo white
   if t_ink = 95 then color rgb (0,0,128)      'navy
   if t_ink = 96 then color rgb (253,245,230)  'old lace
   if t_ink = 97 then color rgb (128,128,0)    'olive
   if t_ink = 98 then color rgb (107,142,35)   'olive drab
   if t_ink = 99 then color rgb (255,165,0)    'orange
   if t_ink = 100 then color rgb (255,69,0)    'orange red
   if t_ink = 101 then color rgb (218,112,214) 'orchid
   if t_ink = 102 then color rgb (238,232,170) 'pale golden rod
   if t_ink = 103 then color rgb (152,251,152) 'pale green
   if t_ink = 104 then color rgb (175,238,238) 'pale turquoise
   if t_ink = 105 then color rgb (219,112,147) 'pale violet red
   if t_ink = 106 then color rgb (255,239,213) 'papaya whip
   if t_ink = 107 then color rgb (255,218,185) 'peach puff
   if t_ink = 108 then color rgb (205,133,63)  'peru
   if t_ink = 109 then color rgb (255,192,203) 'pink
   if t_ink = 110 then color rgb (221,160,221) 'plum
   if t_ink = 111 then color rgb (176,224,230) 'powder blue
   if t_ink = 112 then color rgb (128,0,128)   'purple
   if t_ink = 113 then color rgb (255,0,0)     'red
   if t_ink = 114 then color rgb (188,143,143) 'rosy brown
   if t_ink = 115 then color rgb (65,105,225)  'royal blue
   if t_ink = 116 then color rgb (139,69,19)   'saddle brown
   if t_ink = 117 then color rgb (250,128,114) 'salmon
   if t_ink = 118 then color rgb (244,164,96)  'sandy brown
   if t_ink = 119 then color rgb (46,139,87)   'sea green
   if t_ink = 120 then color rgb (255,245,238) 'sea shell
   if t_ink = 121 then color rgb (160,82,45)   'sienna
   if t_ink = 122 then color rgb (192,192,192) 'silver
   if t_ink = 123 then color rgb (135,206,235) 'sky blue
   if t_ink = 124 then color rgb (106,90,205)  'slate blue
   if t_ink = 125 then color rgb (112,128,144) 'slate gray
   if t_ink = 126 then color rgb (255,250,250) 'snow
   if t_ink = 127 then color rgb (0,255,127)   'spring green
   if t_ink = 128 then color rgb (70,130,180)  'steel blue
   if t_ink = 129 then color rgb (210,180,140) 'tan
   if t_ink = 130 then color rgb (0,128,128)   'teal
   if t_ink = 131 then color rgb (216,191,216) 'thistle
   if t_ink = 132 then color rgb (255,99,71)   'tomato
   if t_ink = 133 then color rgb (64,224,208)  'turquoise
   if t_ink = 134 then color rgb (238,130,238) 'violet
   if t_ink = 135 then color rgb (245,222,179) 'wheat
   if t_ink = 136 then color rgb (255,255,255) 'white
   if t_ink = 137 then color rgb (245,245,245) 'white smoke
   if t_ink = 138 then color rgb (255,255,0)   'yellow
   if t_ink = 139 then color rgb (154,205,50)  'yellow green
end sub

sub t_fd (byval t_distance as double)
dim as integer t_a, t_vm, t_dist
dim as double t_x2, t_y2, t_x3, t_y3

if t_turtle = 0 and t_style_line = 0 then
   t_new_position_x = t_position_x + ((t_distance * t_scale) * cos(t_heading))
   t_new_position_y = t_position_y - ((t_distance * t_scale) * sin(t_heading))
   t_position_x = t_new_position_x
   t_position_y = t_new_position_y
end if
if t_turtle = 1 and t_style_line = 0 then
   t_new_position_x = t_position_x + ((t_distance * t_scale) * cos(t_heading))
   t_new_position_y = t_position_y - ((t_distance * t_scale) * sin(t_heading))
   line (t_position_x, t_position_y)-(t_new_position_x, t_new_position_y)
   t_position_x = t_new_position_x
   t_position_y = t_new_position_y
end if

if t_turtle = 1 and t_style_line = 1 then
t_a = len(t_model)
for  t_dist =   1  to  t_distance
            t_vm = (asc (mid(t_model,t_c1, 1)))
               if  t_vm > 64  and t_vm < 91 then
                            t_x2 = t_position_x + ((t_dist* t_scale) * cos(t_heading))
                            t_y2 = t_position_y - ((t_dist* t_scale) * sin(t_heading))
                            if t_thick = 0 then
                                pset (t_x2, t_y2)
                                else
                                circle (t_x2, t_y2), t_thick,,,,,f
                            end if
                            t_c2 = t_c2 + 1
                            if t_c2 > (t_vm -64) then t_c2 =  1 : t_c1 = t_c1 +1
                            if t_c1 >  t_a then t_c1 =1
                end if
               
                if  t_vm > 96 and t_vm < 123  then
                           t_x3 = t_position_x + ((t_dist* t_scale) * cos(t_heading))
                           t_y3 = t_position_y - ((t_dist* t_scale) * sin(t_heading))
                                if t_thick = 0 then
                                    'pset (t_x3, t_y3)
                                else
                                    'circle (t_x3, t_y3), t_thick,,,,,f
                                end if
                           t_c3 = t_c3 + 1
                           if t_c3 > (t_vm -96) then t_c3 =  1 : t_c1 = t_c1 +1
                           if t_c1 >  t_a then t_c1 =1
                end if
        next t_dist
t_position_x =  t_position_x + ((t_distance * t_scale) * cos(t_heading))
t_position_y =  t_position_y - ((t_distance * t_scale) * sin(t_heading))

end If
end sub

sub t_gt (byval t_pos_x as double, byval t_pos_y as double)
   t_position_x = t_center_screen_x + (t_pos_x * t_scale)
   t_position_y = t_center_screen_y + (t_pos_y * t_scale)
end sub

sub t_home ()
   t_position_x = t_center_screen_x
   t_position_y = t_center_screen_y
end sub

sub t_init ()
   screen 19,32
   screeninfo t_w , t_h
   window (-t_w/2,-t_h/2)-(t_w/2,t_h/2)
   t_active_pattern_on
    t_init_pattern
   t_center_screen_x = 0
   t_center_screen_y = 0
   t_color 109
   t_gt (t_position_x , t_position_y)
   t_init_style_line
   t_model = "Z"
   t_new_position_x = t_position_x
   t_new_position_y = t_position_y
   t_position_x = t_center_screen_x
   t_position_y = t_center_screen_y
   t_scale = 1
   t_style_line_off
   t_thick = 0
   t_turtle_on
    t_active_secondary_on
    t_active_secondary_off
end sub

sub t_init_style_line ()
   t_c1 = 1 : t_c2 = 1 : t_c3 = 1
end sub

sub t_init_pattern ()
t_c1 = 1
t_c2 = 1
t_c3 = 1
end sub

sub t_lt (byval t_angle as double)
   t_heading = t_heading - t_radians (t_angle)
end sub

sub t_orient_l (byval t_angle as double)
   t_heading = t_radians (t_angle * (- 1))
end sub

sub t_orient_r (byval t_angle as double)
   t_heading = t_radians (t_angle)
end sub

sub t_pattern_color (byval t_distance as double)
dim as integer t_a, t_vm
dim as double t_x2, t_y2, t_x3, t_y3

t_a = len(t_model)
t_vm = (asc (mid(t_model,t_c1, 1)))
if  t_vm > 64  and t_vm < 91 then
t_x2 = t_position_x + ((t_distance * t_scale) * cos(t_heading))
t_y2 = t_position_y - ((t_distance * t_scale) * sin(t_heading))
            if t_thick = 0 then
                pset (t_x2, t_y2)
                else
                circle (t_x2, t_y2), t_thick,,,,,f
            end if
                t_c2 = t_c2 + 1
                if t_c2 > (t_vm -64) then t_c2 =  1 : t_c1 = t_c1 +1
                if t_c1 >  t_a then t_c1 =1
end if
               
if  t_vm > 96 and t_vm < 123  then
t_x3 = t_position_x + ((t_distance * t_scale) * cos(t_heading))
t_y3 = t_position_y - ((t_distance * t_scale) * sin(t_heading))
            if t_thick = 0 then
                'pset (t_x3, t_y3)
                else
                'circle (t_x3, t_y3), t_thick,,,,,f
                end if
                t_c3 = t_c3 + 1
                if t_c3 > (t_vm -96) then t_c3 =  1 : t_c1 = t_c1 +1
                if t_c1 >  t_a then t_c1 =1
end if
t_position_x =  t_position_x + ((t_distance * t_scale) * cos(t_heading))
t_position_y =  t_position_y - ((t_distance * t_scale) * sin(t_heading))
end sub


sub t_photo ()
   dim as integer t_nn, t_long_date_time
   dim as string t_date_time, t_name_photo, t_photo_y
   t_date_time = date
   t_long_date_time = len (t_date_time)
   t_name_photo = ""
   t_photo_y = ""
   for t_nn = 1 to t_long_date_time
      t_photo_y= mid(t_date_time,t_nn,1)
      if t_photo_y <> "-" then t_name_photo = t_name_photo + t_photo_y
   next t_nn
   t_name_photo = t_name_photo + "_"
   t_date_time = time
   t_long_date_time = len (t_date_time)
   t_photo_y = ""
   for t_nn = 1 to t_long_date_time
      t_photo_y= mid(t_date_time,t_nn,1)
      if t_photo_y <> ":" then t_name_photo = t_name_photo + t_photo_y
   next t_nn
   bsave t_name_photo+".bmp",0
end sub

sub t_pos (byval t_pos_x as double, byval t_pos_y as double)
   t_turtle_off
   t_gt (t_pos_x, t_pos_y)
   t_turtle_on
end sub

sub t_pos_rot_xy(byval t_po_ro_x as double, byval t_po_ro_y as double)
   t_pos_rot_x = t_po_ro_x
   t_pos_rot_y = t_po_ro_y
end sub

sub t_rot_l (byval t_distance as double, byval t_angle as double)
   t_position_x = ((t_distance * t_scale) * cos(t_radians (t_angle)))+t_pos_rot_x
   t_position_y = ((t_distance * t_scale) * sin(t_radians (t_angle)))+t_pos_rot_y
   t_heading = t_radians (t_angle * (- 1))
end sub

sub t_rot_r (byval t_distance as double, byval t_angle as double)
   t_position_x = ((t_distance * t_scale) * cos(t_radians (t_angle*-1)))+t_pos_rot_x
   t_position_y = ((t_distance * t_scale) * sin(t_radians (t_angle*-1)))+t_pos_rot_y
   t_heading = t_radians (t_angle)
end sub

sub t_rt (byval t_angle as double)
   t_heading = t_heading + t_radians (t_angle)
end sub

sub t_style_line_off ()
   t_style_line = 0
end sub

sub t_style_line_on ()
   t_style_line = 1
end sub

sub t_turtle_off ()
   t_turtle = 0
end sub

sub t_turtle_on ()
   t_turtle = 1
end sub



Regards
Tourist Trap
Posts: 2197
Joined: Jun 02, 2015 16:24

Re: New Turtle_8 (Prototipe)

Postby Tourist Trap » Oct 18, 2015 12:28

Thanks, nice to see you still on the breach!
lrcvs
Posts: 555
Joined: Mar 06, 2008 19:27
Location: Spain

Re: Library for drawing turtle type (Logo turtle)

Postby lrcvs » Oct 18, 2015 18:50


Return to “Projects”

Who is online

Users browsing this forum: Tasos Georgas and 2 guests