SchemeExt:Edges:sample

From DocR23

Jump to: navigation, search
Showproduct.png



Contents

Action

Samples points along a set of contiguous edges at equal arc length, equal turning, or both.

Filename

scm/scmext/kern/samp_edges_scm.cpp

APIs

api_sample_edges

Syntax

(edges:sample edges samp_opts [acis-opts=NULL])

Argument Types

Argument Scheme Data Type
edges edge or (edge ...)
samp_opts sample-edges-options
acis-opts acis-options

Returns

(position ...)

Description

This Scheme extension samples a contiguous set of edges with equal spacing, at any density. For example, the edges may come from slicing a solid model with a plane. Spacing can be measured in terms of curve arc length, or turning, or both. Density can be specified as total number of samples, or as point spacing distance.

Sampling is similar to faceting, but with two differences. First, sampling maintains a high level of accuracy compared to faceting: points will not be further apart than the specified spacing, within a tight tolerance. Second, sampling always avoids too close points, except possibly the last sample.

Arguments

  • edges is a list of contiguous edges.
  • samp_opts is a sample-edges-options object, created with the Scheme extension sample-edges:options.
  • acis-opts (optional) specifies versioning and journaling.

Example 1

In this example, we specify a maximum length of 3 units between sample points. Note that the last two sampled points are closer.

(define spiral (edge:spiral (position 0 0 0)  (gvector 0 0 10)  (gvector 0 5 0) 2 1800))
(define ed (list-ref (entity:edges spiral) 0))
(define max_len 3.0)
(define seo (sample-edges:options 'do_max_len max_len))
(define posList (edges:sample ed seo))
(define points (map point posList))
(entity:set-color points 1)
Spiral Sampled with a Max Length of 3

Example 2

In this example we specify a maximum turning angle of π / 10 radians. Note that the last two sampled points are closer. It is instructive to compare the spiral example for sampling at equal length with sampling at equal turning.

(define spiral (edge:spiral (position 0 0 0)  (gvector 0 0 10)  (gvector 0 5 0) 2 1800))
(define ed (list-ref (entity:edges spiral) 0))
(define cur (curve:from-edge ed))
(define max_turn 0.31416)
(define seo (sample-edges:options 'do_max_turning max_turn))
(define posList (edges:sample ed seo))
(define points (map point posList))
(entity:set-color points 1)
Spiral Sampled with a Max Turning Angle of π / 10 radians.
Personal tools