1.3.49
 
Loading...
Searching...
No Matches
helios_vector_types.h File Reference
#include <cassert>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#include <limits>

Go to the source code of this file.

Data Structures

struct  helios::int2
 Vector of two elements of type 'int'. More...
 
struct  helios::int3
 Vector of three elements of type 'int'. More...
 
struct  helios::int4
 Vector of four elements of type 'int'. More...
 
struct  helios::uint2
 Vector of two elements of type 'unsigned int'. More...
 
struct  helios::uint3
 Vector of three elements of type 'unsigned int'. More...
 
struct  helios::uint4
 Vector of four elements of type 'unsigned int'. More...
 
struct  helios::vec2
 Vector of two elements of type 'float'. More...
 
struct  helios::vec3
 Vector of three elements of type 'float'. More...
 
struct  helios::vec4
 Vector of four elements of type 'float'. More...
 
struct  helios::RGBcolor
 R-G-B color vector. More...
 
struct  helios::RGBAcolor
 R-G-B-A color vector. More...
 
struct  helios::Date
 Date vector. More...
 
struct  helios::Time
 Time vector. More...
 
struct  helios::Location
 Location vector. More...
 
struct  helios::SphericalCoord
 Vector of spherical coordinates (elevation,azimuth) More...
 

Macros

#define M_PI   3.14159265358979323846
 

Typedefs

typedef unsigned int uint
 

Functions

constexpr int2 helios::make_int2 (int x, int y)
 Make an int2 vector from two ints.
 
int2 helios::make_int2 (int X[2])
 Make an int2 vector from an array of ints.
 
constexpr int3 helios::make_int3 (int X, int Y, int Z)
 Make an int3 vector from three ints.
 
constexpr int3 helios::make_int3 (int X[3])
 Make an int2 vector from an array of ints.
 
constexpr int4 helios::make_int4 (int x, int y, int z, int w)
 Make an int4 vector from three ints.
 
constexpr int4 helios::make_int4 (const int X[4])
 Make an int4 vector from an array of ints.
 
constexpr uint2 helios::make_uint2 (unsigned int x, unsigned int y)
 Make a uint2 vector from two unsigned ints.
 
constexpr uint2 helios::make_uint2 (unsigned int X[2])
 Make a uint2 vector from an array of unsigned ints.
 
constexpr uint3 helios::make_uint3 (unsigned int X, unsigned int Y, unsigned int Z)
 Make a uint3 vector from three unsigned ints.
 
constexpr uint3 helios::make_uint3 (unsigned int X[3])
 Make a uint3 vector from an array of unsigned ints.
 
constexpr uint4 helios::make_uint4 (unsigned int x, unsigned int y, unsigned int z, unsigned int w)
 Make a uint4 vector from four unsigned ints.
 
constexpr uint4 helios::make_uint4 (const unsigned int X[4])
 Make a uint4 vector from an array of unsigned ints.
 
constexpr vec2 helios::operator* (float a, const vec2 &v) noexcept
 Multiply each element by scalar (scalar is multiplied on left: a*vec2)
 
constexpr vec2 helios::operator+ (float a, const vec2 &v) noexcept
 Add a scalar to each element (scalar is added on left: a+vec2)
 
constexpr vec2 helios::operator- (float a, const vec2 &v) noexcept
 Subtract a scalar from each element (scalar is subtracted on left: a-vec2)
 
constexpr vec2 helios::make_vec2 (float x, float y)
 Make a vec2 from two floats.
 
vec2 helios::normalize (const vec2 &v)
 
constexpr vec3 helios::operator* (float a, const vec3 &v) noexcept
 Multiply each element by scalar (scalar is multiplied on left: a*vec3)
 
constexpr vec3 helios::operator+ (float a, const vec3 &v) noexcept
 Add a scalar to each element (scalar is added on left: a+vec3)
 
constexpr vec3 helios::operator- (float a, const vec3 &v) noexcept
 Subtract a scalar from each element (scalar is subtracted on left: a-vec3)
 
constexpr vec3 helios::make_vec3 (float x, float y, float z)
 Make a vec3 from three floats.
 
constexpr vec3 helios::make_vec3 (float X[3])
 Make a vec3 from an array of floats.
 
constexpr vec3 helios::cross (const vec3 &a, const vec3 &b)
 Cross product of two vec3 vectors.
 
vec3 helios::normalize (const vec3 &v) noexcept
 
constexpr vec4 helios::operator* (float a, const vec4 &v) noexcept
 Multiply each element by scalar (scalar is multiplied on left: a*vec4)
 
constexpr vec4 helios::operator+ (float a, const vec4 &v) noexcept
 Add a scalar to each element (scalar is added on left: a+vec4)
 
constexpr vec4 helios::operator- (float a, const vec4 &v) noexcept
 Subtract a scalar from each element (scalar is subtracted on left: a-vec4)
 
constexpr vec4 helios::make_vec4 (float x, float y, float z, float w)
 Make a vec4 from three floats.
 
constexpr vec4 helios::make_vec4 (float X[4])
 Make a vec4 from an array of floats.
 
vec4 helios::normalize (const vec4 &v)
 
RGBcolor helios::make_RGBcolor (float red, float green, float blue)
 Make an RGBcolor vector.
 
RGBcolor helios::blend (const RGBcolor &color0, const RGBcolor &color1, float weight)
 Blend two RGB colors together.
 
RGBAcolor helios::make_RGBAcolor (float r, float g, float b, float a)
 Make an RGBAcolor vector.
 
RGBAcolor helios::make_RGBAcolor (RGBcolor color, float a)
 Make an RGBAcolor vector (add alpha channel to RGBcolor)
 
RGBAcolor helios::blend (const RGBAcolor &color0, const RGBAcolor &color1, float weight)
 Blend two RGBA colors together.
 
Date helios::make_Date (int day, int month, int year)
 Make a Date vector.
 
Date helios::Julian2Calendar (int JulianDay, int year)
 Convert a Julian day to a calendar Date vector.
 
int helios::Calendar2Julian (Date date)
 Convert a calendar Date vector to Julian day.
 
Date helios::make_Date (int JulianDay, int year)
 Make a Date vector.
 
Time helios::make_Time (int hour, int minute)
 Make a Time vector.
 
Time helios::make_Time (int hour, int minute, int second)
 Make a Time vector.
 
Location helios::make_Location (float latitude_deg, float longitude_deg, float UTC_offset)
 Make a Location vector.
 
SphericalCoord helios::make_SphericalCoord (float elevation_radians, float azimuth_radians)
 Make a SphericalCoord by specifying elevation and azimuth.
 
SphericalCoord helios::make_SphericalCoord (float radius, float elevation_radians, float azimuth_radians)
 Make a SphericalCoord by specifying radius, elevation, and azimuth.
 

Detailed Description

Declarations for vector types

Copyright (C) 2016-2025 Brian Bailey

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Definition in file helios_vector_types.h.

Macro Definition Documentation

◆ M_PI

#define M_PI   3.14159265358979323846

Definition at line 20 of file helios_vector_types.h.

Typedef Documentation

◆ uint

typedef unsigned int uint

Definition at line 23 of file helios_vector_types.h.

Function Documentation

◆ blend() [1/2]

RGBAcolor helios::blend ( const RGBAcolor color0,
const RGBAcolor color1,
float  weight 
)

Blend two RGBA colors together.

Parameters
[in]color0First color to blend
[in]color1Second color to blend
[in]weightWeighting to apply to each color during blending. E.g., weight=0 will produce color0, weight=0.5 will be an average of color0 and color1, weight=1 will produce color1.
[in]color0First color to be blended.
[in]color1Second color to be blended.
[in]weightWeighting factor (0<weight<1). A weight of 0 returns color0, weight of 1 returns color1.

Definition at line 93 of file global.cpp.

◆ blend() [2/2]

RGBcolor helios::blend ( const RGBcolor color0,
const RGBcolor color1,
float  weight 
)

Blend two RGB colors together.

Parameters
[in]color0First color to blend
[in]color1Second color to blend
[in]weightWeighting to apply to each color during blending. E.g., weight=0 will produce color0, weight=0.5 will be an average of color0 and color1, weight=1 will produce color1.
[in]color0First color to be blended.
[in]color1Second color to be blended.
[in]weightWeighting factor (0<weight<1). A weight of 0 returns color0, weight of 1 returns color1.

Definition at line 84 of file global.cpp.

◆ cross()

constexpr vec3 helios::cross ( const vec3 a,
const vec3 b 
)
constexpr

Cross product of two vec3 vectors.

Definition at line 987 of file helios_vector_types.h.

◆ make_int3() [1/2]

constexpr int3 helios::make_int3 ( int  X,
int  Y,
int  Z 
)
constexpr

Make an int3 vector from three ints.

Definition at line 200 of file helios_vector_types.h.

◆ make_int3() [2/2]

constexpr int3 helios::make_int3 ( int  X[3])
constexpr

Make an int2 vector from an array of ints.

Definition at line 205 of file helios_vector_types.h.

◆ make_int4() [1/2]

constexpr int4 helios::make_int4 ( const int  X[4])
constexpr

Make an int4 vector from an array of ints.

Definition at line 308 of file helios_vector_types.h.

◆ make_int4() [2/2]

constexpr int4 helios::make_int4 ( int  x,
int  y,
int  z,
int  w 
)
constexpr

Make an int4 vector from three ints.

Definition at line 303 of file helios_vector_types.h.

◆ make_SphericalCoord() [1/2]

SphericalCoord helios::make_SphericalCoord ( float  elevation_radians,
float  azimuth_radians 
)
inline

Make a SphericalCoord by specifying elevation and azimuth.

Parameters
[in]elevation_radiansElevation angle (radians)
[in]azimuth_radiansAzimuthal angle (radians)

Definition at line 2064 of file helios_vector_types.h.

◆ make_SphericalCoord() [2/2]

SphericalCoord helios::make_SphericalCoord ( float  radius,
float  elevation_radians,
float  azimuth_radians 
)
inline

Make a SphericalCoord by specifying radius, elevation, and azimuth.

Parameters
[in]radiusRadius
[in]elevation_radiansElevation angle (radians)
[in]azimuth_radiansAzimuthal angle (radians)

Definition at line 2074 of file helios_vector_types.h.

◆ make_vec3() [1/2]

constexpr vec3 helios::make_vec3 ( float  x,
float  y,
float  z 
)
constexpr

Make a vec3 from three floats.

Definition at line 977 of file helios_vector_types.h.

◆ make_vec3() [2/2]

constexpr vec3 helios::make_vec3 ( float  X[3])
constexpr

Make a vec3 from an array of floats.

Definition at line 982 of file helios_vector_types.h.

◆ make_vec4() [1/2]

constexpr vec4 helios::make_vec4 ( float  x,
float  y,
float  z,
float  w 
)
constexpr

Make a vec4 from three floats.

Definition at line 1183 of file helios_vector_types.h.

◆ make_vec4() [2/2]

constexpr vec4 helios::make_vec4 ( float  X[4])
constexpr

Make a vec4 from an array of floats.

Definition at line 1188 of file helios_vector_types.h.

◆ normalize() [1/3]

vec2 helios::normalize ( const vec2 v)
inline

Definition at line 794 of file helios_vector_types.h.

◆ normalize() [2/3]

vec3 helios::normalize ( const vec3 v)
inlinenoexcept

Definition at line 991 of file helios_vector_types.h.

◆ normalize() [3/3]

vec4 helios::normalize ( const vec4 v)
inline

Definition at line 1192 of file helios_vector_types.h.

◆ operator*() [1/3]

constexpr vec2 helios::operator* ( float  a,
const vec2 v 
)
constexprnoexcept

Multiply each element by scalar (scalar is multiplied on left: a*vec2)

Definition at line 856 of file helios_vector_types.h.

◆ operator*() [2/3]

constexpr vec3 helios::operator* ( float  a,
const vec3 v 
)
constexprnoexcept

Multiply each element by scalar (scalar is multiplied on left: a*vec3)

Definition at line 1057 of file helios_vector_types.h.

◆ operator*() [3/3]

constexpr vec4 helios::operator* ( float  a,
const vec4 v 
)
constexprnoexcept

Multiply each element by scalar (scalar is multiplied on left: a*vec4)

Definition at line 1262 of file helios_vector_types.h.

◆ operator+() [1/3]

constexpr vec2 helios::operator+ ( float  a,
const vec2 v 
)
constexprnoexcept

Add a scalar to each element (scalar is added on left: a+vec2)

Definition at line 836 of file helios_vector_types.h.

◆ operator+() [2/3]

constexpr vec3 helios::operator+ ( float  a,
const vec3 v 
)
constexprnoexcept

Add a scalar to each element (scalar is added on left: a+vec3)

Definition at line 1037 of file helios_vector_types.h.

◆ operator+() [3/3]

constexpr vec4 helios::operator+ ( float  a,
const vec4 v 
)
constexprnoexcept

Add a scalar to each element (scalar is added on left: a+vec4)

Definition at line 1242 of file helios_vector_types.h.

◆ operator-() [1/3]

constexpr vec2 helios::operator- ( float  a,
const vec2 v 
)
constexprnoexcept

Subtract a scalar from each element (scalar is subtracted on left: a-vec2)

Definition at line 848 of file helios_vector_types.h.

◆ operator-() [2/3]

constexpr vec3 helios::operator- ( float  a,
const vec3 v 
)
constexprnoexcept

Subtract a scalar from each element (scalar is subtracted on left: a-vec3)

Definition at line 1049 of file helios_vector_types.h.

◆ operator-() [3/3]

constexpr vec4 helios::operator- ( float  a,
const vec4 v 
)
constexprnoexcept

Subtract a scalar from each element (scalar is subtracted on left: a-vec4)

Definition at line 1254 of file helios_vector_types.h.