# struct Geode::Point3(T)

## Overview

Three dimensional point.

T is the scalar type.

## Defined in:

geode/points/point3.cr

## Instance Method Summary

### Instance methods inherited from struct `Geode::Point(T, 3)`

, , , , , , , , , ,

, ,

## Constructor Detail

def self.new(x : T, y : T, z : T) #

Creates a point from its coordinates.

def self.new(&) #

Constructs the point by yielding for each coordinate.

The value of each coordinate should be returned from the block. The block will be given the index of each coordinate as an argument.

``Point3(Int32).new { |i| i + 5 } # => (5, 6, 7)``

## Class Method Detail

def self.[](x : T, y : T, z : T) #

Constructs a point with existing coordinates.

The type of the coordinates is derived from the type of each argument.

``Point3[1, 2, 3] # => (1, 2, 3)``

def self.[](x, y, z) #

Constructs a point with existing coordinates.

The type of the coordinates is specified by the type parameter. Each value is cast to the type T.

``Point3F[1, 2, 3] # => (1.0, 2.0, 3.0)``

## Instance Method Detail

def inspect(io : IO) : Nil #

Produces a debugger-friendly string representation of the point.

def to_column : Matrix3x1(T) #

Converts this point to a column vector, in other words a matrix with one column.

``````point = Point3[5, 7, 9]
point.to_column # => [[5], [7], [9]]``````

def to_row : Matrix1x3(T) #

Converts this point to a row vector, in other words a matrix with one row.

``````point = Point3[5, 7, 9]
point.to_row # => [[5, 7, 9]]``````

def to_vector #

Converts this point to a vector.

``````point = Point3[5, 7, 9]
point.to_vector # => (5, 7, 9)``````

def tuple : Tuple(T, T, T) #

Retrieves the coordinates as a tuple.

def x : T #

Retrieves the x-coordinate.

def y : T #

Retrieves the y-coordinate.

def z : T #

Retrieves the z-coordinate.