Main Content

cart2hom

Convert Cartesian coordinates to homogeneous coordinates

Description

example

hom = cart2hom(cart) converts a set of points in Cartesian coordinates to homogeneous coordinates.

Examples

collapse all

c = [0.8147 0.1270 0.6324; 0.9058 0.9134 0.0975];
h = cart2hom(c)
h = 2×4

    0.8147    0.1270    0.6324    1.0000
    0.9058    0.9134    0.0975    1.0000

Input Arguments

collapse all

Cartesian coordinates, specified as an n-by-k matrix, containing n points. Each row of cart represents a point in k-dimensional space. k must be greater than or equal to 1.

Example: [0.8147 0.1270 0.6324; 0.9058 0.9134 0.0975]

Output Arguments

collapse all

Homogeneous points, returned as an n-by-(k+1) matrix, containing n points. k must be greater than or equal to 1.

Example: [0.2785 0.9575 0.1576 0.5; 0.5469 0.9649 0.9706 0.5]

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2015a

expand all