badness {knotR} | R Documentation |
Badness of knots
Description
Various functions that calculate different aspects of the badness of a knot, generally with low values representing pleasing visual representations
Usage
badness(b, cpb, weights, prob=0, give=FALSE)
curvature_switching_badness(b)
curvature_consecutive_segment_switching_badness(b, ...)
midpoint_badness(b,cpb)
node_crossing_badness(b,cpb)
total_string_length(b)
total_bending_energy(b,power=2)
total_crossing_potential_energy(b,cpb)
total_crossing_angle_badness(b,cpb)
metrics(b,cpb)
always_left_badness(b)
non_crossing_strand_close_approach_badness(b,cpb)
Arguments
b |
A description of a knot, coerced to a |
cpb |
Optional argument containing information on crossing
points (it is short for ‘ |
prob |
In function |
give |
In function |
power |
Function |
weights |
A vector of weights specifying the relative importance of the various badness measures. See details |
... |
In function
|
Details
Various functions that calculate different aspects of the badness of a
knot, generally with low values representing pleasing visual
representations. Function badness()
returns a weighted sum of
nine individual badnesses.
The list below details the values returned by metrics()
; the
description of each item is the name of corresponding weight assigned by
the weights
argument of badness()
.
- pot
Function
total_crossing_potential_energy()
gives the potential energy of the nodes, under an inverse square force law- ang
Function
total_crossing_angle_badness()
returns a high value if strands cross at angles far from 90 degrees. It returns the sum, over all crossings, ofbezier_angle()
- ben
Function
total_bending_energy()
gives the total bending energy, effectively the arc integral of the reciprocal of the square of the radius of curvature- len
Function
total_string_length()
returns\ell
, the total string length. The badness is proportional to(\ell-5000)^2
. A length of 5000 corresponds to knots that look about right on a sheet of A4 paper- mid
Function
midpoint_badness()
penalizes knots with crossing points far from the midpoint of segments- clo
Function
node_crossing_badness()
penalizes knots with nodes too close together (compare functiontotal_crossing_potential_energy()
)- swi
Function
curvature_switching_badness()
provides a penalty for consecutive segments with curvatures that switch sign. The magnitude of the penalty is zero if both curvatures are of the same sign, otherwise proportional to the square of the minimum of the maximum value of the absolute value of the positive and negative curvatures. The source code is easier to look at, honest- con
Function
curvature_consecutive_segment_switching_badness()
penalizes knots with consecutive segments that switch curvature from positive to negative- ncn
Function
always_left_badness()
penalizes knots that are supposed to curve to the left all the time (eg knot8_{18}
). The penalty is proportional to the greatest rightward curvature over the whole knot
The weights
argument is nominally a vector of length 9 which is
used to assign weights to different aspects of the badness of a knot.
Value
Returns a scalar badness
Author(s)
Robin K. S. Hankin
See Also
Examples
# use the k_infinity knot for speed:
system.time(badness(k_infinity))
cc <- crossing_points(k_infinity)
system.time(badness(k_infinity,cc))
metrics(k_infinity,cc)
## default:
badness(k_infinity, weights=c(1,1,1,1,1,1,1,1,1))
## downweight the importance of strands crossing at 90 degrees:
badness(k_infinity, weights=c(1,0.1,1,1,1,1,1,1,1))