RPGNext
Take Your RPG Development to theNextLevel
Site Links
Home
RPG Programming
xRPG Downloads
xRPG Docs
About This Site
About Me

RPG Gurus
Bob Cozzi
Brad Stone
Scott Klement
Jon Paris

iSeries Links
Alpha Works
Midrange.com
FAQ@Midrange.com
MidrangeServer.com
IBM Docs
iSeries Infocenter
MCPress
Easy400
API Finder

xRPG Core Library RNBMATH Service Program: Polygons Procedures


Working with Polygons, especially irregular polygons, can be a real hassle. These procedures, part of the xRPG RNBMATH Service program, will help you work with polygons in RPG Programs. The approach is vaguely object oriented because the procedures retain information about the polygon data (until cleared).

A polygon is based on a collection of points with X and Y coordinates. Use the addPolygonPoint procedure to add a series of points. If your points are saved in a scale other than the actual scale, such as saved in pixels where 10 pixels = 1 foot, then you can set the scale to ".1" which will convert all calculations to the correct value. If your scale is accurate (i.e. 1=1) then you do not need to adjust the scale.

Once the points are created, you can calculate the number of points, the area, or the perimeter. Be aware that both the area and perimeter functions will clear the polygon points and the scale by default, so if you want to retain it you need to use the optional "savePoints" parameter.

Procedures

This site conforms with the following W3C specifications:

Web Essentials

Contact