Action:
|
Computes where a law is the maximum over a given interval.
|
|
Filename:
|
kern/kern_scm/law_scm.cxx
|
|
Syntax:
|
(law:nmax law low-lim up-lim)
|
|
Arg Types:
|
law
|
law | string | real | position |
|
|
|
par-pos | gvector
|
|
low-lim
|
real
|
|
up-lim
|
real
|
|
Returns:
|
real
|
|
Description:
|
law:nmax computes where a law is the maximum over a given interval.
|
|
|
law can be a defined law, a law string, or a constant number.
|
|
|
low-lim and
up-lim are two real values that specify the interval.
|
|
|
The example defines
law1 to be the law that returns the curvature of
testcur1 with its parameter range mapped to [0,1]. The "CurC" law returns the curvature of its curve. Because the radius of curvature is the reciprocal of the curvature, finding where
law1 is maximum finds where the radius of curvature is minimum, or where the tightest turn in the curve is located.
|
|
Example:
|
; law:nmax
|
|
; Define a list of points for a spline edge
|
|
(define plist (list (position 0 0 0)
|
|
|
(position 20 20 0) (position 40 0 0)
|
|
|
(position 60 25 0) (position 40 50 0)
|
|
|
(position 20 30 0) (position 0 50 0)))
|
|
;; plist
|
|
(define start (gvector 1 1 0))
|
|
;; start
|
|
(define end (gvector -1 1 0))
|
|
;; end
|
|
(define testcur1 (edge:spline plist start end))
|
|
;; testcur1
|
|
(define law1
|
|
|
(law "map(Curc(edge1),edge1)" testcur1))
|
|
;; law1
|
|
(define maxpoint (law:nmax law1 0 1))
|
|
;; maxpoint
|
|
; All curves in Scheme are parameterized from 0 to 1.
|
|
(define point1 (dl-item:point
|
|
|
(curve:eval-pos testcur1 maxpoint)))
|
|
;; point1
|
|
(dl-item:display point1)
|
|
;; ()
|
|
; OUTPUT Result
|
|
|
|
Figure 14-1. law:nmax - First Maximum Point on a Test Curve
|