knotR (version 1.0-2)

badness: 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)
metrics(b,cpb)
always_left_badness(b)
non_crossing_strand_close_approach_badness(b,cpb)

Value

Returns a scalar badness

Arguments

b

A description of a knot, coerced to a controlpoints object

cpb

Optional argument containing information on crossing points; expensive to calculate, so providing this makes the code run faster

prob

In function badness(), the probability of plotting a knotplot. Nonzero values are useful when optimizing a knot, to keep tabs on the process

give

In function badness(), Boolean with default FALSE meaning to return the sum of the badnesses, and TRUE meaning to return them separately

power

Function total_bending_energy() returns the arc integral of \(R^{-p}\); defaults to 2

weights

A vector of weights specifying the relative importance of the various badness measures

...

In function curvature_consecutive_segment_switching_badness(), extra arguments passed to integrate()

Author

Robin K. S. Hankin

Details

Various functions that calculate different aspects of the badness of a knot, generally with low values representing pleasing visual representations:

  • Function badness() returns the sum of the eight individual badnesses.

  • Function curvature_switching_badness() provides a penalty for segments with curvatures that switch sign. The magnitude of the penalty is zero if the curvature is of one 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 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 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 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_crossing_potential_energy() gives the potential energy of the nodes, under an inverse square force law.

  • 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.

  • Function metrics() gives all these.

Examples

Run this code


# 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)

Run the code above in your browser using DataLab