rect(3f) - [M_draw:POLYGONS] Draw a rectangle given two corners (LICENSE:PD)
Synopsis
Description
Options
Examples
subroutine rect(x1, y1, x2, y2)
real,intent(in) :: x1,y1,x2,y2
Draw rectangle given two opposite corners.Note: rectangles are regarded as polygons, so if polyfill or polyhatch has been called with .TRUE., the rectangle will be filled or hatched accordingly.
Given
x1,y1 ############ x2,y1 # # # # # # x1,y2 ############ x2,y2
X1,Y1 coordinates of a corner of the rectangle X2,Y2 coordinates of corner point opposite first point
Sample program:
program demo_rect use M_draw use M_draw, only : D_BLACK, D_WHITE use M_draw, only : D_RED, D_GREEN, D_BLUE use M_draw, only : D_YELLOW, D_MAGENTA, D_CYAN implicit none integer :: ipaws real :: b=0.2!! set up graphics area call prefsize(1000,200) call vinit( ) ! start graphics using device $M_DRAW_DEVICE call page(-25.0-b, 25.0+b, -5.0-b, 5.0+b)
call linewidth(150) call color(D_RED) call rect(-24.0, -4.0, -12.0, 4.0) call polyfill(.true.) call color(D_GREEN) call rect(-10.0, -4.0, -2.0, 4.0) call polyhatch(.true.) call hatchpitch(0.4) call hatchang(30.0) call linewidth(20) call color(D_BLUE) call rect(0.0, -4.0, 20.0, 3.0) call linewidth(200) call color(D_BLUE) call move2(-25.0, -5.0) call draw2(-25.0, 5.0) call draw2(25.0, 5.0) call draw2(25.0, -5.0) call draw2(-25.0, -5.0)
!! pause call vflush() ipaws=getkey()
!! wrap up graphics call vexit()
end program demo_rect
Nemo Release 3.1 | rect (3) | February 23, 2025 |