badness: Badness of knots

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12

Arguments

b

A description of a knot, coerced to a controlpoints object

cpb

Optional argument containing information on crossing points (it is short for ‘crossing_points(b)’). It is time-consuming to calculate, so providing a precalculated value makes the code run faster

prob

In function badness(), the probability of plotting a knotplot. I used nonzero values in the early stages of developing the package: when optimizing a knot it was useful 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 1/R^p; defaults to 2

weights

A vector of weights specifying the relative importance of the various badness measures. See details

...

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

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_angles() returns a high value if strands cross at angles far from 90 degrees. It returns the sum, over all crossings, of bezier_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 l, the total string length. The badness is proportional to (l-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 function total_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 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.

Value

Returns a scalar badness

Author(s)

Robin K. S. Hankin

See Also

crossing

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# 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))

RobinHankin/knotR documentation built on Jan. 3, 2020, 10:53 p.m.