Action:
|
Creates visible vector field lines along an edge or wire.
|
|
Filename:
|
kern/kern_scm/law_scm.cxx
|
|
APIs:
|
api_hedgehog
|
|
Syntax:
|
(law:hedgehog
|
|
|
{path vector-list [number-hair [size]]} |
|
|
|
{hair-law base-law start-x end-x
|
|
|
{[number-hair] | [start-y end-y [number-hair]] |
|
|
|
[start-y end-y start-z end-z [number-hair]]}})
|
|
Arg Types:
|
path
|
entity
|
|
vector-list
|
law | (law ...)
|
|
number-hair
|
integer
|
|
size
|
real
|
|
hair-law
|
law | string | gvector
|
|
base-law
|
law | string | position
|
|
start-x
|
real
|
|
end-x
|
real
|
|
start-y
|
real
|
|
end-y
|
real
|
|
start-z
|
real
|
|
end-z
|
real
|
|
Returns:
|
boolean
|
|
Description:
|
The
law:hedgehog extension defines vector fields that are attached to a curve. They are useful for defining orientation when sweeping along a non-planar path. There are two major ways to use this command. The determination as to which method is used is based on the first argument type.
|
|
|
If the first argument is an
entity, as would be the case for a wire body or edge, then that argument is assumed to be thepath and should be followed by a Scheme list of laws,
vector-list Optionally, the number of hairs on the hedgehog and its size can be specified.
|
|
|
If the first argument is not an
entity, then it is assumed to be a
hair-law, which can be a
law,
string, or
gvector.
hair-law specifies the direction for the hair vectors. This is followed by
base-law., which specifies what is to receive the vector field. Thereafter, this can be followed by 0 or up to 5 arguments.
number-hair specifies the number of vectors to use. The
start and
end parameters limit the range for displaying the vector field.
|
|
Example:
|
; law:hedgehog
|
|
; The edge is not required, but is useful
|
|
; for visualization purposes. It is defined
|
|
; the same as base-law.
|
|
(define edge1
|
|
|
(edge:law "vec(cos(x),sin(x),x/10)" 0 50))
|
|
;; edge1
|
|
(define base-law
|
|
|
(law "vec(cos(x),sin(x),x/10)"))
|
|
;; base-law
|
|
(define vector-law (law "vec(cos(x),sin(x),0)"))
|
|
;; vector-law
|
|
(define hedgehog1 (law:hedgehog vector-law
|
|
|
base-law 0 50 200 ))
|
|
;; hedgehog1
|
|
|
; Another example.
|
|
; Clear out the result of the previous example
|
|
(part:clear)
|
|
;; #t
|
|
; The face is not required, but is useful
|
|
; for visualization purposes. It is defined
|
|
; the same as base-law.
|
|
(define face1
|
|
|
(face:law "vec(x,y,cos(x)*sin(y))" -5 5 -5 5))
|
|
;; face1
|
|
(define base-law1(law "vec(x,y,cos(x)*sin(y))"))
|
|
;; base-law1
|
|
(define dx (law:derivative base-law))
|
|
;; dx
|
|
(define dy(law:derivative base-law1 "y"))
|
|
;; dy
|
|
(define norm (law "cross(law1,law2)" dx dy))
|
|
;; norm
|
|
(define hedgehog2 (law:hedgehog norm
|
|
|
base-law -5 5 -5 5 20 ))
|
|
;; hedgehog2
|
|
|
; Another example.
|
|
; Clear out the previous example
|
|
(part:clear)
|
|
;; #t
|
|
(dl-item:erase hedgehog2)
|
|
;; ()
|
|
(define base-law2 (law "vec(x,y,z)"))
|
|
;; base-law2
|
|
(define hair-law (law "norm(vec(x,y,z))"))
|
|
;; hair-law
|
|
(define hedgehog3 (law:hedgehog hair-law
|
|
|
base-law -10 10 -10 10 -10 10))
|
|
;; hedgehog3
|
|
; Clean up the DL items.
|
|
;(dl-item:erase hedgehog3)
|
|
; ()
|