badness | R Documentation |
Various functions that calculate different aspects of the badness of a knot, generally with low values representing pleasing visual representations
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)
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
|
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()
.
Function total_crossing_potential_energy()
gives the
potential energy of the nodes, under an inverse square force law
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, of bezier_angle()
Function total_bending_energy()
gives the total bending
energy, effectively the arc integral of the reciprocal of the square
of the radius of curvature
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
Function midpoint_badness()
penalizes knots with
crossing points far from the midpoint of segments
Function node_crossing_badness()
penalizes knots with
nodes too close together (compare function
total_crossing_potential_energy()
)
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
Function
curvature_consecutive_segment_switching_badness()
penalizes
knots with consecutive segments that switch curvature from positive
to negative
Function always_left_badness()
penalizes knots that are
supposed to curve to the left all the time (eg knot
8_{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.
Returns a scalar badness
Robin K. S. Hankin
crossing
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.