Gambas文档
主题
代码片段
名词解释
如何操作
应用程序仓库
废弃的组件
开发环境文档
开发者文档
教程
文档
最新修改
组件
gb
gb.args
gb.cairo
gb.chart
gb.clipper
Clipper
Point
PointF
Polygon
Rect
RectF
gb.complex
gb.compress
gb.crypt
gb.data
gb.db
gb.db.form
gb.db.mysql
gb.db.odbc
gb.db.postgresql
gb.db.sqlite2
gb.db.sqlite3
gb.dbus
gb.dbus.trayicon
gb.debug
gb.desktop
gb.desktop.x11
gb.eval
gb.eval.highlight
gb.form
gb.form.dialog
gb.form.editor
gb.form.htmlview
gb.form.mdi
gb.form.print
gb.form.terminal
gb.gmp
gb.gsl
gb.gtk
gb.gtk3
gb.gtk3.opengl
gb.gtk3.webview
gb.gui
gb.gui.qt
gb.gui.qt.ext
gb.gui.trayicon
gb.gui.webview
gb.hash
gb.highlight
gb.image
gb.image.effect
gb.image.io
gb.inotify
gb.logging
gb.map
gb.media
gb.media.form
gb.mime
gb.mongodb
gb.mysql
gb.ncurses
gb.net
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.opengl
gb.opengl.glsl
gb.opengl.glu
gb.opengl.sge
gb.openssl
gb.option
gb.pcre
gb.pdf
gb.poppler
gb.qt4
gb.qt4.ext
gb.qt4.opengl
gb.qt4.webkit
gb.qt4.webview
gb.qt5
gb.qt5.ext
gb.qt5.opengl
gb.qt5.webview
gb.qt6
gb.qt6.ext
gb.qt6.opengl
gb.qt6.webview
gb.report
gb.report2
gb.sdl
gb.sdl2
gb.sdl2.audio
gb.settings
gb.signal
gb.term
gb.test
gb.util
gb.util.web
gb.v4l
gb.vb
gb.web
gb.web.feed
gb.web.form
gb.web.gui
gb.xml
gb.xml.html
gb.xml.rpc
gb.xml.xslt
维基手册
维基搜索
维基许可协议
编译和安装
语言概览
语言索引
说明
错误消息

Clipper.Offset (gb.clipper)

Static Function Offset ( Polygons As Polygon[], Delta As Float [ , Join As Integer, Limit As Float, DoNotFix As Boolean ] ) As Polygon[]

This function offsets the Polygons parameter by the Delta amount. Positive delta values expand outer polygons and contract inner 'hole' polygons. Negative deltas do the reverse.

Edge joins is specified by the Join argument, and may be one of three jointypes:

  • Clipper.JoinMiter: Limit sets the maximum distance in multiples of delta that vertices can be offset from their original positions before squaring is applied. The default value is 2 (ie twice delta) which is also the smallest allowed value. If offsetting was allowed without any limits (ie without squaring), then offsetting at very acute angles would produce unacceptably long 'spikes'.

  • Clipper.JoinRound: Limit sets the maximum distance that rounded joins can deviate from their true arcs (since it would require an infinite number of vertices to perfectly represent an arc). The default limit is 0.25 units though realistically precision can never be better than 0.5 since arc coordinates will still be rounded to integer values. When offsetting polygons with very large coordinate values (typically as a result of scaling), it's advisable to increase limit to maintain consistent precisions at all joins because the maximum number of vertices allowed in any arc is 222. (This hard coded upper limit has been chosen because the imprecision in a circle constructed with 222 vertices will be only 1/10000th its radius and, not only is creating very large numbers of arc vertices computationally expensive, it can cause out-of-memory problems.)

  • Clipper.JoinSquare: The Limit parameter is ignored.

The polygons passed to the Offset method must not be self-intersecting and need to be oriented such that outer polygons have a true orientation and hole polygons have a false orientation. If the orientations of input polygons are incorrect, the function will return unexpected results. Likewise, 'duplicate vertices' (ie consecutive vertices with identical coordinates, including start and end vertices) cause problems with the offset algorithm.

The DoNotFix parameter when FALSE will force the function to check for and fix incorrect polygon orientations and remove duplicate vertices. However, it will not fix self-intersections. (Self-intersections can be removed by calling the Offset method.) If orientations are known to be correct and there's no likelihood of duplicate vertices, then it's advisable to set autoFix to false since 'auto-fixing' is computationally expensive.