File: polygonTest.pcm

package info (click to toggle)
extrema 4.4.4.dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 19,416 kB
  • ctags: 6,689
  • sloc: cpp: 88,991; sh: 8,229; makefile: 480
file content (17 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
clear
!
GEN\RANDOM X -5 5 2000            ! generate some "data"
GEN\RANDOM Y 10 20 2000           !
WINDOW 5                          !
SET %XNUMBERSHEIGHT 5             !
SET %YNUMBERSHEIGHT 5             !
SET PLOTSYMBOL -11                ! choose unjoined point plotting symbol
GRAPH X Y                         ! display the data graphically
XP = {-0.5;1.2;-0.2;1.3;-3;-2}    ! the polygon vertices 
YP = {13;13.5;16;18.5;18;14}      !
POLYGON\OUTSIDE XP YP X Y K       ! find data points outside polygon, create key vector, K
WINDOW\INHERIT 7 5                !
IDX = WHERE(K=1)                  ! choose indices of points inside polygon
GRAPH X[IDX] Y[IDX]               ! display data without unwanted points
SET PLOTSYMBOL 0                  ! choose no plotting symbol
GRAPH\OVERLAY XP//{-0.5} YP//{13} ! overlay the polygon (close by appending first point)