hkl-vector-private: hkl Reference Manual

## hkl-vector-private hkl-vector-private |

## Functions

HklVector * | hkl_vector_dup ()
void | hkl_vector_free ()
void | hkl_vector_fprintf ()
int | hkl_vector_cmp ()
int | hkl_vector_is_opposite ()
void | hkl_vector_add_vector ()
void | hkl_vector_minus_vector ()
void | hkl_vector_div_double ()
void | hkl_vector_times_double ()
void | hkl_vector_times_vector ()
void | hkl_vector_times_matrix ()
double | hkl_vector_sum ()
double | hkl_vector_scalar_product ()
void | hkl_vector_vectorial_product ()
double | hkl_vector_angle ()
double | hkl_vector_oriented_angle ()
double | hkl_vector_oriented_angle_points ()
double | hkl_vector_norm2 ()
int | hkl_vector_normalize ()
int | hkl_vector_is_colinear ()
void | hkl_vector_randomize ()
void | hkl_vector_randomize_vector ()
void | hkl_vector_randomize_vector_vector ()
void | hkl_vector_rotated_around_vector ()
void | hkl_vector_rotated_quaternion ()
void | hkl_vector_rotated_around_line ()
int | hkl_vector_is_null ()
void | hkl_vector_project_on_plan ()
void | hkl_vector_project_on_plan_with_point ()

## Description

## Functions

### hkl_vector_dup ()

    HklVector *
    hkl_vector_dup (const HklVector *self);

Copy an HklVector

[skip]

#### Parameters

self | the HklVector to copy |

#### Returns

A copy of self which need to be free using hkl_vector_free

### hkl_vector_free ()

    void
    hkl_vector_free (HklVector *self);

delete an HklVector struct

[skip]

### hkl_vector_fprintf ()

    void
    hkl_vector_fprintf (FILE *file,
                        const HklVector *self);

print an HklVector into a stream

[skip]

#### Parameters

file | the stream to print into |
self | the HklVector to print. |

### hkl_vector_cmp ()

    int
    hkl_vector_cmp (const HklVector *self,
                    const HklVector *vector);

compare two HklVector. this comparison use HKL_EPSILON to do the comparison.

[skip]

#### Parameters

self | the first vector |
vector | th vector to compare with |

#### Returns

FALSE if both are equals, TRUE otherwise.

### hkl_vector_is_opposite ()

    int
    hkl_vector_is_opposite (const HklVector *self,
                            const HklVector *vector);

Check if two vectors are oposite.

[skip]

#### Returns

TRUE is vector are oposite vectors.

### hkl_vector_add_vector ()

    void
    hkl_vector_add_vector (HklVector *self,
                           const HklVector *vector);

add an HklVector to another one.

[skip]

#### Parameters

self | the modified HklVector |
vector | the hklvector to add |

### hkl_vector_minus_vector ()

    void
    hkl_vector_minus_vector (HklVector *self,
                             const HklVector *vector);

substract an HklVector to another one.

[skip]

#### Parameters

self | the modified HklVector |
vector | the hklvector to substract |

### hkl_vector_div_double ()

    void
    hkl_vector_div_double (HklVector *self,
                           const double d);

divide an HklVector by constant.

[skip]

#### Parameters

self | the HklVector to divide. |
d | constant use to divide the HklVector |

### hkl_vector_times_double ()

    void
    hkl_vector_times_double (HklVector *self,
                             const double d);

multiply an HklVector by a constant value.

[skip]

#### Parameters

self | the HklVector to modify |
d | the multiply factor |

### hkl_vector_times_vector ()

    void
    hkl_vector_times_vector (HklVector *self,
                             const HklVector *vector);

multiply an HklVector by another one. This method multiply coordinate by coordinate.

[skip]

#### Parameters

self | the HklVector to modify |
vector | the HklVector use to modify the first one |

### hkl_vector_times_matrix ()

    void
    hkl_vector_times_matrix (HklVector *self,
                             const HklMatrix *m);

multiply an HklVector by an HklMatrix. compute v'= M . v

[skip]

#### Parameters

self | the HklVector to multiply |
m | the HklMatrix use to multiply the HklVector |

### hkl_vector_sum ()

    double
    hkl_vector_sum (const HklVector *self);

compute the HklVector sum of all its elements.

[skip]

#### Parameters

self | the HklVector to sum. |

#### Returns

the sum of all elements.

### hkl_vector_scalar_product ()

    double
    hkl_vector_scalar_product (const HklVector *self,
                               const HklVector *vector);

compute the scalar product of two HklVector

[skip]

#### Parameters

self | the first HklVector |
vector | the second HklVector |

#### Returns

the scalar product.

### hkl_vector_vectorial_product ()

    void
    hkl_vector_vectorial_product (HklVector *self,
                                  const HklVector *vector);

compute the vectorial product of two vectors

[skip]

#### Parameters

self | the first HklVector (modify) |
vector | the second HklVector |

### hkl_vector_angle ()

    double
    hkl_vector_angle (const HklVector *self,
                      const HklVector *vector);

compute the angles beetween two HklVector

[skip]

#### Parameters

self | the fist HklVector |
vector | the second HklVector |

#### Returns

the return value is in beetween [0, pi]

### hkl_vector_oriented_angle ()

    double
    hkl_vector_oriented_angle (const HklVector *self,
                               const HklVector *vector,
                               const HklVector *ref);

compute the angles beetween two HklVector and use a reference HklVector to orientate the space. That's way the return value can be in beetween [-pi, pi]. the (self, vector, ref) is a right oriented base.

[skip]

#### Parameters

self | the first HklVector |
vector | the second HklVector |
ref | the reference HklVector |

#### Returns

the angles [-pi, pi]

### hkl_vector_oriented_angle_points ()

    double
    hkl_vector_oriented_angle_points (const HklVector *self,
                                      const HklVector *p2,
                                      const HklVector *p3,
                                      const HklVector *ref);

compute the angles beetween three points (p1, p2, p3) and use a reference HklVector to orientate the space. That's way the return value can be in beetween [-pi, pi]. the (self, vector, ref) is a right oriented base.

[skip]

#### Parameters

self | the first point |
p2 | the second point |
p3 | the third point |
ref | the reference HklVector |

#### Returns

the angles [-pi, pi]

### hkl_vector_norm2 ()

    double
    hkl_vector_norm2 (const HklVector *self);

compute the norm2 of an HklVector

[skip]

#### Parameters

self | the hklvector use to compute the norm2 |

#### Returns

the sqrt(|v|)

### hkl_vector_normalize ()

    int
    hkl_vector_normalize (HklVector *self);

normalize a hkl_vector

[skip]

#### Parameters

self | the HklVector to normalize |

#### Returns

TRUE if the HklVector can be normalized, FALSE otherwise

### hkl_vector_is_colinear ()

    int
    hkl_vector_is_colinear (const HklVector *self,
                            const HklVector *vector);

check if two HklVector are colinears

[skip]

#### Parameters

self | the first HklVector |
vector | the second HklVector |

#### Returns

TRUE if both are colinear.

### hkl_vector_randomize ()

    void
    hkl_vector_randomize (HklVector *self);

initialize a vector with random values. coordinates range [-1, 1]

[skip]

#### Parameters

self | the HklVector to randomize |

### hkl_vector_randomize_vector ()

    void
    hkl_vector_randomize_vector (HklVector *self,
                                 const HklVector *vector);

randomize an HklVector an be sure that it is not equal to the HklVector vector.

[skip]

#### Parameters

self | the HklVector to randomize |
vector | the HklVector result to avoid |

### hkl_vector_randomize_vector_vector ()

    void
    hkl_vector_randomize_vector_vector (HklVector *self,
                                        const HklVector *vector1,
                                        const HklVector *vector2);

randomize an HklVector an be sure that it is not equal to the HklVector vector1 and vector2.

[skip]

#### Parameters

self | the HklVector to randomize |
vector1 | the first HklVector solution to avoid |
vector2 | the second HklVector solution to avoid |

### hkl_vector_rotated_around_vector ()

    void
    hkl_vector_rotated_around_vector (HklVector *self,
                                      const HklVector *axe,
                                      double angle);

rotate a vector around another one with a given angle.

[skip]

#### Parameters

self | the HklVector to rotate |
axe | the axe of rotation |
angle | the angle of the rotation |

### hkl_vector_rotated_quaternion ()

    void
    hkl_vector_rotated_quaternion (HklVector *self,
                                   const HklQuaternion *qr);

rotate an HklVector using an HklQuaternion.

[skip]

#### Parameters

self | the HklVector to rotate |
qr | the HklQuaternion use to rotate the vector |

### hkl_vector_rotated_around_line ()

    void
    hkl_vector_rotated_around_line (HklVector *self,
                                    double angle,
                                    const HklVector *c1,
                                    const HklVector *c2);

This method rotate a point around a line defined by two points of a certain amount of angle. The rotation is right handed. this mean that c2 - c1 gives the direction of the rotation.

[skip]

#### Parameters

self | the point to rotate around a line |
angle | the angle of the rotation |
c1 | the fist point of the line |
c2 | the second point of the line |

### hkl_vector_is_null ()

    int
    hkl_vector_is_null (const HklVector *self);

check if all the coordinates of an HklVector are null.

[skip]

#### Parameters

self | the hklvector to check |

#### Returns

HKl_TRUE if all |elements| are below HKL_EPSILON, HKl_FALSE otherwise

Todo: test

### hkl_vector_project_on_plan ()

    void
    hkl_vector_project_on_plan (HklVector *self,
                                const HklVector *normal);

project an HklVector on a plan of normal which contain the origin [0, 0, 0]

[skip]

#### Parameters

self | the vector to project |
normal | the normal of the plane. |

### hkl_vector_project_on_plan_with_point ()

    void
    hkl_vector_project_on_plan_with_point (HklVector *self,
                                           const HklVector *normal,
                                           const HklVector *point);

project an HklVector on a plan of normal normal which contain point.

[skip]

#### Parameters

self | the vector to project (modify) |
normal | the normal of the plane. |
point | a point of the plan. |