
Calculating Areas in CorelDRAW
CorelDRAW® may be full featured but it is not a Drafting or CADD program. Hence,
it does not provide any way for you to find out the area of the shapes you are working
with.
This is the fifth release (v0.5) of this add-on. still a test release but getting
better (see change history to find out what's
different) as we learn more. (see the FAQ for
things we learned after release)
It has been developed and tested only with Draw v8.433 (SP2 or Rev C)
and with Draw 9.439 (SP2 or Rev C)
(Full source code is provided for your edification and entertainment :)
What it does:
- You can now calculate and mark the Centroid of multiple shapes. These can
be simple shapes or combined shapes with holes. If you are retrieving full
Draw info you can also move the Centroid and have the program move all the
corresponding objects to conform.
- Reports information about the curves in user selectable Units (Inches, Cm, etc...)
in two reports: The Curves Report shows the nodes and Handles of all
recovered curves. The Area Report shows the Areas and other user-selectable
object information. It also shows the Perimeter and the
location of the Centroid. This new release also shows the areas and
perimeters of the holes in objects.
- Information is collected from Draw about the Selected shapes (like name,
ID, size and position) They should be closed curves which do
not self intersect in any way
- Objects are exported to Adobe Illustrator files, one by one or all at
once. These files
are read in and the curve information recovered.
- Objects which yield more than one path are given special treatment to
recover the hierarchical structure of the Combined object they came from.
Holes, Donuts and Shapes are detected here.
- Each of the recovered curves is fed to the area calculation function. Now
using a new function. (Thanks to Nick Wilkinson for the adaptation of the
original from Paul Bourke's original 'C'
code)
- Reports are generated.
- User has the option to change the reporting Units or the # of segments
that curved sections are reduced to as well as the report options and
regenerate the report.
- The Selection in Draw can be changed and the analysis done again without
leaving the program.
Other things it contains which might be interest if you're a Scripter:
- code to retrieve all the node information from curves using
Adobe Illustrator 1.1 files. This code retrieves the curve control handles
as well as the vertices. The only thing is that they've all been converted
to Points first and then back again ...
- code to convert beziér curves into a series of straight line segments
and the code to derive the needed coefficients.
- code to determine just which objects are the selected ones using Draw8 or
Draw9.
- code to retrieve the hierarchy within the exports from Draw's Combined
Objects. It uses a simple bounding-box inclusion test to try to determine geometric
and hierarchical relationships.
At this time there is still no charge for this software, but we would like to know
who's trying it out so ... the link to it is through the form.
Author: Les Johnson Copyright © 2000 Misty Creek Productions Inc. All rights reserved.
Revised:
August 24, 2008
Reference links:
If you have Draw9 and want an alternative to this why not try out Nick Wilkinson's VBA
solution? It can be found in the Cool Tools section at IsoCalc.com
At it's core, this program implements a basic algorithm from the field of
Geometry.
The particular page
that explained this is one of a series
by Paul Bourke.
If you're interested in Geometry and computer graphics then you might want to check it out.
While researching how to calculate the centroid I used these resources in
addition to Paul Bourke's information. You might find them of interest:
Computer Graphics Algorithms FAQ at Exaflop
"This site is intended to provide a solid center for the sharing of ideas and information. Anyone and everyone is invited to contribute to this site."
efg's Computer Lab Graphics (Earl F Gylnn)
Polygon Area and Centroid Lab Report
Graphics Gems Repository
This is the official on-line repository for the code from the Graphics Gems series of books (from Academic Press). This series
focuses on short to medium length pieces of code which perform a wide variety of computer graphics related tasks.
(It is also where the code for the current calculations comes from)
The code to convert bezier curves into line segments is adapted from
information provided in the Adobe® PostScript® Reference manual. It can be found
from this page.
A very valuable source information on things 'postscript'.
And, of course, the company that provides the core engine of this is Corel®.
Corel, and CorelDRAW are registered trademarks of the Corel
Corporation.
|