law
List of: Scheme Data Types
Subjects: Laws
Contents: Scheme Support

Description: A law is a Scheme data type that holds a pointer to a law C++ class. The low-level implementation of laws in Scheme uses API's and law string parsing to create C++ classes from law function strings enclosed in quotation marks.


The law functions are very similar to common mathematical notation and to the adaptation of mathematical notation for use in computers. The valid syntax for the character strings are given in the law function templates.


The strings used to define laws are not case-sensitive, but when returned from a law function, the lower-case letters are converted to upper-case letters. Only laws that are used to define the geometry, such as wire-body:offset and sweep:law, are stored in a save file

Derivation: integer : scheme-object

C++ Type: law

External Rep: #[law "%s"]

where the quoted string represents a valid law made up of law functions.

Example: ; law (data type)

; Create a law.

; The law used as part of mathematical calculations

; is NOT saved to the save file.

(define my_law (law "x+x^2-cos(x)"))

;; my_law

; my_law => #[law "(X+X^2)-COS(X)"]

; #[law "(X+X^2)-COS(X)"]

; Evaluate the given law at 1.5 radians

(law:eval my_law 1.5)

;; 3.6792627983323


; Another example of laws.

(define my_edge (edge:circular (position 0 0 0) 20))

;; my_edge

(define my_wirebody (wire-body my_edge))

;; my_wirebody

; The law used as part of the offset is saved to

; the save file.

(define my_offset (wire-body:offset my_wirebody


"20+10*cos(x*10)"))

;; my_offset
PDF/SCM/09SD.PDF
HTM/DATA/SCM/SCM/09SD/0038.HTM