# Singular

#### D.13.1.33 polytopeViaPoints

Procedure from library `gfan.lib` (see gfan_lib).

Usage:
polytopeViaPoints(V [, flags]); intmat V, int flags

Return:
polytope which is the intersection of the cone generated by the row vectors of V with the hyperplane, in which the first coordinate equals 1; flags may be 0 or 1,
if flags is 1, then program assumes that each row vector of M generates a ray in the cone, if flags is 0, then program computes that information itself

Example:
 ```LIB "gfan.lib"; // This is a polytope in R^2 generated by (0,0), (1,0), (0,1), (0,0); intmat V[4][3]= 1,0,0, 1,1,0, 1,0,1, 1,1,1; polytope p1=polytopeViaPoints(V); p1; ==> AMBIENT_DIM ==> 2 ==> INEQUALITIES ==> 0, 0, 1, ==> 0, 1, 0, ==> 1,-1, 0, ==> 1, 0,-1 ==> EQUATIONS ==> ==> // This is a polytope in R^2 generated by (1/2,2/3), (3/4,4/5), (5/6,6/7): intmat V[3][3]= ==> // ** redefining V (intmat V[3][3]=) 6,3,4, 20,15,16, 42,35,36; polytope p2=polytopeViaPoints(V); p2; ==> AMBIENT_DIM ==> 2 ==> INEQUALITIES ==> -10,-24, 35, ==> -6, -8, 15, ==> 8, 12,-21 ==> EQUATIONS ==> ==> // This polytope is the positive orthant in R^2: // (0,1,0) and (0,0,1) imply that the polytope is unbounded in that direction intmat V[3][3]= ==> // ** redefining V (intmat V[3][3]=) 1,0,0, 0,1,0, 0,0,1; polytope p3=polytopeViaPoints(V); p3; ==> AMBIENT_DIM ==> 2 ==> INEQUALITIES ==> 0,0,1, ==> 0,1,0, ==> 1,0,0 ==> EQUATIONS ==> ==> ```