List of: Scheme Extensions
Subjects: Physical Properties
Contents: Kernel

Action: Returns the angle between edges. Returns a list of angles if a non-branched wire-body is submitted.

Filename: kern/kern_scm/find_scm.cxx

APIs: api_get_edges

Syntax: (find:angle input1 [input2] [logical])

Arg Types: input1 vertex | edge | wire-body

input2 edge

logical real

Returns: real | (real ...)

input1 specifies a vertex, edge or a wire-body. A vertex as input1 computes the angles between the two edges around the vertex. If input1 is a closed edge, the angle between the start and end is returned. If input1 is a non-branched, wire-body, a list of angles between each of the edges of the wire-body is returned.

input2 specifies an edge. input2 must be supplied if input1 is an open edge. The angle between these two edges is returned.

A logical of false (#f) returns the results in radians, the default is degrees.

Limitations: Success is not guaranteed for branched wire-bodies, edges that do not share a vertex, and vertices with more than two edges.

Example: ; find:angle

; Create an entity

(define p1 (wire-body:polygon

(position 0 0 0) (gvector 0 1 0)

(gvector 0 0 1) 5))

;; p1

(define p2 (wire-body:polygon

(position 0 2 0) (gvector 0 -1 0)

(gvector 0 0 1) 5))

;; p2

(define unite (bool:unite p1 p2))

;; unite


;; #[view 25363466]

(define v (list-ref (entity:vertices p1)3))

;; v

(entity:set-color v 1)

;; ()

(find:angle v)

;; 108.0