# struct Geode::Point1(T)

## Overview

One dimensional point.

Using this type generally doesn't make sense, but it is included to complete some rules and combinations.

T is the scalar type.

## Defined in:

geode/points/point1.cr

## Constructors

• .new(x : T)

Creates a point from its coordinates.

• .new(&)

Constructs the point by yielding for each coordinate.

## Class Method Summary

• .[](x : T)

Constructs a point with existing coordinates.

• .[](x)

Constructs a point with existing coordinates.

## Instance Method Summary

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

, , , , , , , , , ,

, ,

## Constructor Detail

def self.new(x : 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.

``Point1(Int32).new { |i| i + 5 } # => (5)``

## Class Method Detail

def self.[](x : T) #

Constructs a point with existing coordinates.

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

``Point1 # => (1)``

def self.[](x) #

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.

``Point1F # => (1.0)``

## Instance Method Detail

def inspect(io : IO) : Nil #

Produces a debugger-friendly string representation of the point.

def to_column : Matrix1x1(T) #

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

``````point = Point1
point.to_column # => []``````

def to_row : Matrix1x1(T) #

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

``````point = Point1
point.to_row # => []``````

def to_vector #

Converts this point to a vector.

``````point = Point1
point.to_vector # => (5)``````

def tuple : Tuple(T) #

Retrieves the coordinates as a tuple.

def x : T #

Retrieves the x-coordinate.