## edu.neu.ccs.gui Interface Tangent.Strategy

Enclosing interface:
Tangent

public static interface Tangent.Strategy

The `Strategy` interface requires methods that return the tangent array for a closed or open Bezier curve from its vertex array and, if needed, its end tangent data.

 Method Summary ` float[][]` `makeTangents(float[][] vertex)`           Returns the tangent array for a closed Bezier curve corresponding to the given vertex array using the encapsulated vertex-to-tangent strategy. ` float[][]` ```makeTangents(float[][] vertex, float[][] endTangent)```           Returns the tangent array for an open Bezier curve corresponding to the given vertex array and the given endTangent data using the encapsulated vertex-to-tangent strategy.

 Method Detail

### makeTangents

`public float[][] makeTangents(float[][] vertex)`

Returns the tangent array for a closed Bezier curve corresponding to the given vertex array using the encapsulated vertex-to-tangent strategy.

Precondition: For some integer N >= 0:

• The given vertex array is float[N][2] with non-`null` entries

Postcondition: For the same integer N:

• The tangent array returned is float[N][2] with non-`null` entries

If the vertex array fails its precondition then the method should return float[0][2].

Parameters:
`vertex` - the vertex array of a closed curve
Returns:
the associated tangent array constructed using the strategy

### makeTangents

```public float[][] makeTangents(float[][] vertex,
float[][] endTangent)```

Returns the tangent array for an open Bezier curve corresponding to the given vertex array and the given endTangent data using the encapsulated vertex-to-tangent strategy.

Precondition 1. For some integer N >= 0:

• The given vertex array is float[N][2] with non-`null` entries

Precondition 2.

• The given endTangent array is either `null` or float[2][2] with non-`null` entries

Postcondition 1. For the same integer N:

• The tangent array returned is float[N][2] with non-`null` entries

Postcondition 2: If the endTangent array is `null`, then the function should return `makeTangents(vertex)`.

Postcondition 3: If the endTangent array is non-`null`:

• If N > 0, for i = 0, 1: `tangent[0][i] == endTangent[0][i]`
• If N > 1, for i = 0, 1: `tangent[N-1][i] == endTangent[1][i]`

If the vertex array fails its precondition then the method should return float[0][2].

If the endTangent array fails its precondition then it should be treated as if it were `null`.

Parameters:
`vertex` - the vertex array of an open curve
`endTangent` - the tangent data for the ends of the open curve
Returns:
the associated tangent array constructed using the strategy