**This is an old revision of the document!**

### Table of Contents

# Curves

## Introduction

- A curve orientation is given by the succession if its points. For example, a straight line is oriented from its first point towards its second point. This orientation is relevant when defining contact matrices, for instance. For 2D rigid-deformable contact, a curve must be defined with “area to the left”, which means that the normal must point towards the inside of the matter (also applicable with
`Surfaces`

in 3D). - The normal of a curve is defined such as $\boldsymbol{t} \wedge \boldsymbol{n} = (0,0,1)$.

## Line: straight segment

A `Line`

(line segment) is defined with its two vertices.

line = curveset.add( Line(number, pt1, pt2) )

## Arc

An `Arc`

of circle is defined using three points, as shown on the figure.

arc = curveset.add( Arc(number, pt1, pt2, pt3) )

## Cubic Spline

### "Open" cubic spline

spl = curveset.add( CubicSpline(number, [pt1, pt2, pt3, pt4]) ) spl.useLsTangent() # tangents are calculated # using local reconstruction [DEFAULT] spl.useLittTangents() # tangents are calculated # using Litt/Beckers lectures

### Closed cubic spline

To close a spline, the first and last points of the list must be the same.

spl = CubicSpline(number,[pt1, pt2, pt3, pt4, ..., pt1])

or, if the curve is defined based on a mesh, the mesh must be chosen closed.

### Spline-reconstruction based on a mesh

It is possible to construct a spline based on the mesh of a line. This way, a smooth approximation of this mesh if obtained.

spl = CubicSpline(number, obj)

where `obj`

is a meshed object.

## Full Circle

A circle is defined with its center and radius (this function is only defined in the $z=0$ plane)

circ2d = curset.add( Circle(number, pt1, radius) )

The orientation of the circle can be inverted (and so will its tangent and normal used for contact):

circ2d.reverse()

### NURBS

A Non-Uniform Rational Basis Spline (Nurb) is defined as:

nur = curset.add( NurbsCurve(number) ) nur.setDegree(degree) nur.push(pt1); nur.pushWeight(weight1) nur.push(pt2); nur.pushWeight(weight2) nur.pushKnot(knot1) nur.pushKnot(knot2)

where

`number` | curve number |

`pt1` , `pt2` | `Points` used as supports |

`degree` | degré de la coube |

`weight1` , `weight2` | weights |

`knot1` , `knot2` | knot vector |

`closed` | Boolean to determine whether the Nurb is closed |

`obj` | GObject support of a topology (curve,wire,group) |

## Interpreted curves

If a curve cannot be defined with the functions above, it can simply be programmed in python, to avoid having to enter Metafor source code.

`PythonCurve`

is the object to use. It is a regular curve, `.push()`

is used to add points, and it possesses four functions that can be parametrized. `setEval(fct)`

is used to defined the evaluation python function.
`setTg`

, `setDTg`

and`setLen()`

respectively define the tangent, its derivative and the curvilinear abscissa. The function `setEval(fct)`

is required to mesh the curve, when the other three are used for contact.

Once this new curve is defined, it can be shaped as the already existing one, with a class. For example, if a parabola has just been defined (cfr. `toolbox.curves`

), it can be used quite simply in a test case (cfr. `apps.qs.parabola`

):

from toolbox.curves import Parabola parab = curset.add(Parabola(1, pt1, pt6, pt2))

These lines create a parabola of user number 1, based on the three previously defined point pt1, pt6 and pt2.