# Struct cgmath::Point3 [−] [src]

```pub struct Point3<S> {
pub x: S,
pub y: S,
pub z: S,
}```

A point in 3-dimensional space.

This type is marked as `#[repr(C, packed)]`.

## Fields

`x: S` `y: S` `z: S`

## Trait Implementations

### `impl<S: Hash> Hash for Point3<S>`[src]

#### `fn hash<__HS: Hasher>(&self, __arg_0: &mut __HS)`

Feeds this value into the state given, updating the hasher as necessary.

#### `fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher`1.3.0

Feeds a slice of this type into the state provided.

### `impl<S: Clone> Clone for Point3<S>`[src]

#### `fn clone(&self) -> Point3<S>`

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`1.0.0

Performs copy-assignment from `source`. Read more

### `impl<S: PartialEq> PartialEq for Point3<S>`[src]

#### `fn eq(&self, __arg_0: &Point3<S>) -> bool`

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, __arg_0: &Point3<S>) -> bool`

This method tests for `!=`.

### `impl<S: BaseNum> Array for Point3<S>`[src]

#### `fn from_value(scalar: S) -> Point3<S>`

Construct a vector from a single value, replicating it. Read more

#### `fn sum(self) -> S where S: Add<Output=S>`

The sum of the elements of the array.

#### `fn product(self) -> S where S: Mul<Output=S>`

The product of the elements of the array.

#### `fn min(self) -> S where S: PartialOrd`

The minimum element of the array.

#### `fn max(self) -> S where S: PartialOrd`

The maximum element of the array.

#### `fn as_ptr(&self) -> *const Self::Element`

Get the pointer to the first element of the array.

#### `fn as_mut_ptr(&mut self) -> *mut Self::Element`

Get a mutable pointer to the first element of the array.

#### `fn swap_elements(&mut self, i: usize, j: usize)`

Swap the elements at indices `i` and `j` in-place.

### `impl<S: BaseFloat> MetricSpace for Point3<S>`[src]

#### `type Metric = S`

The metric to be returned by the `distance` function.

#### `fn distance2(self, other: Self) -> S`

Returns the squared distance. Read more

#### `fn distance(self, other: Self) -> Self::Metric`

The distance between two values.

### `impl<S: BaseNum> EuclideanSpace for Point3<S>`[src]

#### `type Scalar = S`

The associated scalar over which the space is defined. Read more

#### `type Diff = Vector3<S>`

The associated space of displacement vectors.

#### `fn origin() -> Point3<S>`

The point at the origin of the Euclidean space.

#### `fn from_vec(v: Vector3<S>) -> Point3<S>`

Convert a displacement vector to a point. Read more

#### `fn to_vec(self) -> Vector3<S>`

Convert a point to a displacement vector. Read more

#### `fn dot(self, v: Vector3<S>) -> S`

This is a weird one, but its useful for plane calculations.

#### `fn midpoint(self, other: Self) -> Self`

Returns the middle point between two other points. Read more

#### `fn centroid(points: &[Self]) -> Self`

Returns the average position of all points in the slice. Read more

### `impl<S: BaseNum> Add<Vector3<S>> for Point3<S>`[src]

#### `type Output = Point3<S>`

The resulting type after applying the `+` operator

#### `fn add(self, other: Vector3<S>) -> Point3<S>`

The method for the `+` operator

### `impl<'a, S: BaseNum> Add<&'a Vector3<S>> for Point3<S>`[src]

#### `type Output = Point3<S>`

The resulting type after applying the `+` operator

#### `fn add(self, other: &'a Vector3<S>) -> Point3<S>`

The method for the `+` operator

### `impl<'a, S: BaseNum> Add<Vector3<S>> for &'a Point3<S>`[src]

#### `type Output = Point3<S>`

The resulting type after applying the `+` operator

#### `fn add(self, other: Vector3<S>) -> Point3<S>`

The method for the `+` operator

### `impl<'a, 'b, S: BaseNum> Add<&'a Vector3<S>> for &'b Point3<S>`[src]

#### `type Output = Point3<S>`

The resulting type after applying the `+` operator

#### `fn add(self, other: &'a Vector3<S>) -> Point3<S>`

The method for the `+` operator

### `impl<S: BaseNum + AddAssign<S>> AddAssign<Vector3<S>> for Point3<S>`[src]

#### `fn add_assign(&mut self, vector: Vector3<S>)`

The method for the `+=` operator

### `impl<S: BaseNum> Sub<Point3<S>> for Point3<S>`[src]

#### `type Output = Vector3<S>`

The resulting type after applying the `-` operator

#### `fn sub(self, other: Point3<S>) -> Vector3<S>`

The method for the `-` operator

### `impl<'a, S: BaseNum> Sub<&'a Point3<S>> for Point3<S>`[src]

#### `type Output = Vector3<S>`

The resulting type after applying the `-` operator

#### `fn sub(self, other: &'a Point3<S>) -> Vector3<S>`

The method for the `-` operator

### `impl<'a, S: BaseNum> Sub<Point3<S>> for &'a Point3<S>`[src]

#### `type Output = Vector3<S>`

The resulting type after applying the `-` operator

#### `fn sub(self, other: Point3<S>) -> Vector3<S>`

The method for the `-` operator

### `impl<'a, 'b, S: BaseNum> Sub<&'a Point3<S>> for &'b Point3<S>`[src]

#### `type Output = Vector3<S>`

The resulting type after applying the `-` operator

#### `fn sub(self, other: &'a Point3<S>) -> Vector3<S>`

The method for the `-` operator

### `impl<S: BaseNum> Mul<S> for Point3<S>`[src]

#### `type Output = Point3<S>`

The resulting type after applying the `*` operator

#### `fn mul(self, other: S) -> Point3<S>`

The method for the `*` operator

### `impl<'a, S: BaseNum> Mul<S> for &'a Point3<S>`[src]

#### `type Output = Point3<S>`

The resulting type after applying the `*` operator

#### `fn mul(self, other: S) -> Point3<S>`

The method for the `*` operator

### `impl<S: BaseNum> Div<S> for Point3<S>`[src]

#### `type Output = Point3<S>`

The resulting type after applying the `/` operator

#### `fn div(self, other: S) -> Point3<S>`

The method for the `/` operator

### `impl<'a, S: BaseNum> Div<S> for &'a Point3<S>`[src]

#### `type Output = Point3<S>`

The resulting type after applying the `/` operator

#### `fn div(self, other: S) -> Point3<S>`

The method for the `/` operator

### `impl<S: BaseNum> Rem<S> for Point3<S>`[src]

#### `type Output = Point3<S>`

The resulting type after applying the `%` operator

#### `fn rem(self, other: S) -> Point3<S>`

The method for the `%` operator

### `impl<'a, S: BaseNum> Rem<S> for &'a Point3<S>`[src]

#### `type Output = Point3<S>`

The resulting type after applying the `%` operator

#### `fn rem(self, other: S) -> Point3<S>`

The method for the `%` operator

### `impl<S: BaseNum + MulAssign<S>> MulAssign<S> for Point3<S>`[src]

#### `fn mul_assign(&mut self, scalar: S)`

The method for the `*=` operator

### `impl<S: BaseNum + DivAssign<S>> DivAssign<S> for Point3<S>`[src]

#### `fn div_assign(&mut self, scalar: S)`

The method for the `/=` operator

### `impl<S: BaseNum + RemAssign<S>> RemAssign<S> for Point3<S>`[src]

#### `fn rem_assign(&mut self, scalar: S)`

The method for the `%=` operator

### `impl<S> Index<usize> for Point3<S>`[src]

#### `type Output = S`

The returned type after indexing

#### `fn index<'a>(&'a self, i: usize) -> &'a S`

The method for the indexing (`Foo[Bar]`) operation

### `impl<S> IndexMut<usize> for Point3<S>`[src]

#### `fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut S`

The method for the indexing (`Foo[Bar]`) operation

### `impl<S> Index<Range<usize>> for Point3<S>`[src]

#### `type Output = [S]`

The returned type after indexing

#### `fn index<'a>(&'a self, i: Range<usize>) -> &'a [S]`

The method for the indexing (`Foo[Bar]`) operation

### `impl<S> IndexMut<Range<usize>> for Point3<S>`[src]

#### `fn index_mut<'a>(&'a mut self, i: Range<usize>) -> &'a mut [S]`

The method for the indexing (`Foo[Bar]`) operation

### `impl<S> Index<RangeTo<usize>> for Point3<S>`[src]

#### `type Output = [S]`

The returned type after indexing

#### `fn index<'a>(&'a self, i: RangeTo<usize>) -> &'a [S]`

The method for the indexing (`Foo[Bar]`) operation

### `impl<S> IndexMut<RangeTo<usize>> for Point3<S>`[src]

#### `fn index_mut<'a>(&'a mut self, i: RangeTo<usize>) -> &'a mut [S]`

The method for the indexing (`Foo[Bar]`) operation

### `impl<S> Index<RangeFrom<usize>> for Point3<S>`[src]

#### `type Output = [S]`

The returned type after indexing

#### `fn index<'a>(&'a self, i: RangeFrom<usize>) -> &'a [S]`

The method for the indexing (`Foo[Bar]`) operation

### `impl<S> IndexMut<RangeFrom<usize>> for Point3<S>`[src]

#### `fn index_mut<'a>(&'a mut self, i: RangeFrom<usize>) -> &'a mut [S]`

The method for the indexing (`Foo[Bar]`) operation

### `impl<S> Index<RangeFull> for Point3<S>`[src]

#### `type Output = [S]`

The returned type after indexing

#### `fn index<'a>(&'a self, i: RangeFull) -> &'a [S]`

The method for the indexing (`Foo[Bar]`) operation

### `impl<S> IndexMut<RangeFull> for Point3<S>`[src]

#### `fn index_mut<'a>(&'a mut self, i: RangeFull) -> &'a mut [S]`

The method for the indexing (`Foo[Bar]`) operation

### `impl<S> Into<[S; 3]> for Point3<S>`[src]

#### `fn into(self) -> [S; 3]`

Performs the conversion.

### `impl<S> AsRef<[S; 3]> for Point3<S>`[src]

#### `fn as_ref(&self) -> &[S; 3]`

Performs the conversion.

### `impl<S> AsMut<[S; 3]> for Point3<S>`[src]

#### `fn as_mut(&mut self) -> &mut [S; 3]`

Performs the conversion.

### `impl<S: Clone> From<[S; 3]> for Point3<S>`[src]

#### `fn from(v: [S; 3]) -> Point3<S>`

Performs the conversion.

### `impl<'a, S> From<&'a [S; 3]> for &'a Point3<S>`[src]

#### `fn from(v: &'a [S; 3]) -> &'a Point3<S>`

Performs the conversion.

### `impl<'a, S> From<&'a mut [S; 3]> for &'a mut Point3<S>`[src]

#### `fn from(v: &'a mut [S; 3]) -> &'a mut Point3<S>`

Performs the conversion.

### `impl<S> Into<(S, S, S)> for Point3<S>`[src]

#### `fn into(self) -> (S, S, S)`

Performs the conversion.

### `impl<S> AsRef<(S, S, S)> for Point3<S>`[src]

#### `fn as_ref(&self) -> &(S, S, S)`

Performs the conversion.

### `impl<S> AsMut<(S, S, S)> for Point3<S>`[src]

#### `fn as_mut(&mut self) -> &mut (S, S, S)`

Performs the conversion.

### `impl<S> From<(S, S, S)> for Point3<S>`[src]

#### `fn from(v: (S, S, S)) -> Point3<S>`

Performs the conversion.

### `impl<'a, S> From<&'a (S, S, S)> for &'a Point3<S>`[src]

#### `fn from(v: &'a (S, S, S)) -> &'a Point3<S>`

Performs the conversion.

### `impl<'a, S> From<&'a mut (S, S, S)> for &'a mut Point3<S>`[src]

#### `fn from(v: &'a mut (S, S, S)) -> &'a mut Point3<S>`

Performs the conversion.

### `impl<S: Debug> Debug for Point3<S>`[src]

#### `fn fmt(&self, f: &mut Formatter) -> Result`

Formats the value using the given formatter.