project

Purpose

Project a point onto the given polyhedron.

Syntax

ret = P.project(x)
ret = project(P, x)

Description

Computes the projection of the point ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project1.png onto this polyhedron by solving the optimization problem:

../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project11.png

If ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project2.png is a vector of ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project3.png Polyhedra and ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project4.png is a matrix of size ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project5.png, then ret is a cell array with the structure fields that correspond the projection of each point in the matrix.

Input Arguments

P

Polyhedron in any format

Class: Polyhedron

y

Vector of size P.Dim that represent single point ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project6.png, or matrix of size ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project7.png that corresponds to multiple points merged column-wise.

Class: double

Output Arguments

ret

Optimal solution

Class: struct

ret.x

Projected point or [] if ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project8.png is empty
ret.exitflag

Informs about the termination status of the optimization problem.

Class: double

Allowed values:

  • mptopt.OK
  • mptopt.INFEASIBLE
  • mptopt.UNBOUNDED
  • mptopt.ERR

ret.dist

Distance from ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project9.png to the set ../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project10.png.

Example(s)

Example 1

Create polyhedron:
P = ExamplePoly.poly3d_sin;
Choose a point and project:
y = [2;2];

ret = P.project(y);
Plot the result
P.plot; hold on; pplot([ret.x';y'],'or');
      axis square; th=linspace(0,2*pi,100)';
      pplot(ret.dist*[sin(th) cos(th)]+repmat(y',100,1),'k');

../../../../../../fig/mpt/modules/geometry/sets/@Polyhedron/project_img_1.png

See Also

projection


© 2010-2013 Colin Neil Jones: EPF Lausanne, colin.jones@epfl.ch