|
NAMECAD::Drawing::Calculate - Calculations for CAD::DrawingDESCRIPTIONThis module provides calculation functions for the CAD::Drawing family of modules.AUTHOREric L. Wilhelm <ewilhelm at cpan dot org>http://scratchcomputing.com COPYRIGHTThis module is copyright (C) 2004-2006 by Eric L. Wilhelm. Portions copyright (C) 2003 by Eric L. Wilhelm and A. Zahner Co.LICENSEThis module is distributed under the same terms as Perl. See the Perl source package for details.You may use this software under one of the following licenses: (1) GNU General Public License (found at http://www.gnu.org/copyleft/gpl.html) (2) Artistic License (found at http://www.perl.com/pub/language/misc/Artistic.html) NO WARRANTYThis software is distributed with ABSOLUTELY NO WARRANTY. The author, his former employer, and any other contributors will in no way be held liable for any loss or damages resulting from its use.ModificationsThe source code of this module is made freely available and distributable under the GPL or Artistic License. Modifications to and use of this software must adhere to one of these licenses. Changes to the code should be noted as such and this notification (as well as the above copyright information) must remain intact on all copies of the code.Additionally, while the author is actively developing this code, notification of any intended changes or extensions would be most helpful in avoiding repeated work for all parties involved. Please contact the author with any such development plans. SEE ALSOCAD::Drawing CAD::Calc Math::Vec MethodsExtents CalculationsOrthExtentsCalculates the extents of a group of objects (selected according to select_addr()) and returns an array: [xmin,xmax],[ymin,ymax].@extents = $drw->OrthExtents(\%opts); getExtentsRecAlias to OrthExtents() which returns a polyline-form array of points (counter clockwise from lower-left) describing a rectangle.@rec = $drw->getExtentsRec(\%opts); EntOrthExtentsGets the orthographic extents of the object at $addr. Returns [\@xpts,\@y_pts] (leaving you to sort through them and find which is min or max.)@extents = $drw->EntOrthExtents($addr); @orthfuncList of hash references containing code references to reduce duplication and facilitate natural flow (rather than ifififif statements.)Planar Geometry MethodsoffsetIntended as any-object offset function (not easy).$dist is negative to offset outward $drw->offset($object, $dist); divide$drw->divide(); area$drw->area($addr); Line Manipulationspline_to_rayTransforms a polyline with a nubbin into a ray (line with direction.)$line_addr = $drw->pline_to_ray($pline_addr); trim_bothTrims two lines to their intersection.$drw->trim_both($addr1, $addr2, $tol, \@keep_ends); See CAD::Calc::line_intersection() Coordinate TransformsSwitch between coordinate system representations.to_ocsChange the objects coordinates into the object coordinate system.Both of these are relatively quick. A simple test shows that one point can be taken back and forth at about 2KHz, so don't be afraid to use them. $drw->to_ocs($addr); to_wcsChange the object's coordinates into the world coordinate system.$drw->to_wcs($addr); flattenPuts the object in the wcs, zeros all z-coordinates and deletes the normal vector. Note that this is fine for projecting polylines and lines, but may not be what you want if you are trying to make a circle into an ellipse (at least not yet.)$drw->flatten($addr); FunctionsNon-OO internal-use functions._ocs_axesReturns the x,y, and z axes for the ocs described by @normal. These will have arbitrary lengths.@local_axes = _ocs_axes(@normal); _wcs_axesReturns the x,y, and z axes for the world coordinate system in terms of the @ocs_axes.@trs_axes = _wcs_axes(@ocs_axes);
Visit the GSP FreeBSD Man Page Interface. |