## GwyXY

GwyXY — Cartesian coordinates in plane

## Functions

GwyXY * | gwy_xy_new ()
GwyXY * | gwy_xy_copy ()
void | gwy_xy_free ()
gdouble | gwy_xy_len ()
gdouble | gwy_xy_len2 ()
gdouble | gwy_xy_dist2 ()
gdouble | gwy_xy_dotprod ()
gdouble | gwy_xy_crossprodz ()

## Includes

    #include <libgwyddion/gwyddion.h>

## Description

## Functions

### gwy_xy_new()

    GwyXY *
    gwy_xy_new (gdouble x,
                gdouble y);

Creates Cartesian coordinates in plane.

This is mostly useful for language bindings.

#### Parameters

x | X-coordinate. |
y | Y-coordinate. |

#### Returns

New XY structure. The result should be freed using `gwy_xy_free()`.

### gwy_xy_copy()

    GwyXY *
    gwy_xy_copy (const GwyXY *xy);

Copies Cartesian coordinates in plane.

#### Parameters

xy | Cartesian coordinates in plane. |

#### Returns

A copy of `xy` . The result should be freed using `gwy_xy_free()`.

### gwy_xy_free()

    void
    gwy_xy_free (GwyXY *xy);

Frees Cartesian coordinates in plane created with `gwy_xy_copy()`.

#### Parameters

xy | Cartesian coordinates in plane. |

### gwy_xy_len()

    gdouble
    gwy_xy_len (const GwyXY *xy);

Computes the length of a plane vector.

#### Parameters

xy | Cartesian coordinates in plane. |

#### Returns

The vector length.

### gwy_xy_len2()

    gdouble
    gwy_xy_len2 (const GwyXY *xy);

Computes the squared length of a plane vector.

#### Parameters

xy | Cartesian coordinates in plane. |

#### Returns

The squared vector length.

### gwy_xy_dist2()

    gdouble
    gwy_xy_dist2 (const GwyXY *xy,
                  const GwyXY *other);

Computes the squared length of the difference of two plane vectors.

#### Parameters

xy | Cartesian coordinates in plane. |
other | Cartesian coordinates in plane. |

#### Returns

The squared length.

### gwy_xy_dotprod()

    gdouble
    gwy_xy_dotprod (const GwyXY *xy,
                    const GwyXY *other);

Computes the inner product of two plane vectors.

#### Parameters

xy | Cartesian coordinates in plane. |
other | Cartesian coordinates in plane. |

#### Returns

The inner product `xy` ⋅`other` .

### gwy_xy_crossprodz()

    gdouble
    gwy_xy_crossprodz (const GwyXY *xy,
                       const GwyXY *other);

Computes the Z-component of a cross-product of two vectors given as plane vectors.

The vectors are interpreted the X and Y components of two space vectors which have zero Z-components. Their cross-product then has only one nonzero component: Z. This is what the function calculates.

#### Parameters

xy | Cartesian coordinates in plane. |
other | Cartesian coordinates in plane. |

#### Returns

The Z-component of inner product `xy` ×`other` .