Perception Tool Kit (PTK) API Guide

Introduction

Collaboration diagram for PTK Plane:

Data Structures

struct  PTK_Plane
 Definition of a plane. More...
 

Functions

int32_t PTK_Plane_set (PTK_Plane *dst, float nx, float ny, float nz, float d)
 Set all four values for a point as a convenience function. At least one of nx, ny, nz must be non-zero. More...
 
void PTK_Plane_normalize (PTK_Plane *dst, PTK_Plane *src)
 Normalize plane parameters so that nx^2+ny^2+nz^2=1. More...
 
void PTK_Plane_transform (PTK_Plane *dst, PTK_Plane *src, const PTK_RigidTransform *M_dst_src)
 Apply the given rigid transformation to represent the plane (given in src reference frame) in dst reference frame. Output plane will have the same normalization factor as the input plane. More...
 
float PTK_Plane_dot (const PTK_Plane *plane, const PTK_Point *point)
 Dot product between a plane and a 3d point (x,y,z), which is out = x*nx + y*nx + z*nz - d. If the plane is the normalized, then out is the signed distance of the point from the plane, where positive is in the direction of the normal vector. More...
 
int32_t PTK_Plane_construct (PTK_Plane *plane, PTK_Point *a, PTK_Point *b, PTK_Point *c)
 Construct normalized plane from 3 non-colinear points in 3D space by taking cross product. More...
 
void PTK_Plane_projectPoint (PTK_Plane *plane, PTK_Point *proj, PTK_Point *point)
 Project 3D point onto the plane. More...
 

Function Documentation

◆ PTK_Plane_set()

int32_t PTK_Plane_set ( PTK_Plane dst,
float  nx,
float  ny,
float  nz,
float  d 
)

Set all four values for a point as a convenience function. At least one of nx, ny, nz must be non-zero.

Parameters
[in,out]dstPointer to Plane to be modified
[in]nxNew nx value
[in]nyNew ny value
[in]nzNew nz value
[in]dNew d value

return

  • 0 on success
  • -1 on fail

◆ PTK_Plane_normalize()

void PTK_Plane_normalize ( PTK_Plane dst,
PTK_Plane src 
)

Normalize plane parameters so that nx^2+ny^2+nz^2=1.

Parameters
[in,out]srcPointer to input plane
[in,out]dstPointer to normalized plane. Can be same as src.

◆ PTK_Plane_transform()

void PTK_Plane_transform ( PTK_Plane dst,
PTK_Plane src,
const PTK_RigidTransform M_dst_src 
)

Apply the given rigid transformation to represent the plane (given in src reference frame) in dst reference frame. Output plane will have the same normalization factor as the input plane.

Parameters
[in]srcPointer to source plane
[in,out]dstPointer to destination plane, which may be the same as src
[in]M_dst_srcThe rigid transformation to be applied

◆ PTK_Plane_dot()

float PTK_Plane_dot ( const PTK_Plane plane,
const PTK_Point point 
)

Dot product between a plane and a 3d point (x,y,z), which is out = x*nx + y*nx + z*nz - d. If the plane is the normalized, then out is the signed distance of the point from the plane, where positive is in the direction of the normal vector.

Parameters
[in]planePointer to plane
[in]pointPointer to point
Returns
Result of the dot product. dot product out = point.x*plane.nx + point.y*plane.ny + point.z*plane.nz - plane.d

◆ PTK_Plane_construct()

int32_t PTK_Plane_construct ( PTK_Plane plane,
PTK_Point a,
PTK_Point b,
PTK_Point c 
)

Construct normalized plane from 3 non-colinear points in 3D space by taking cross product.

Parameters
[out]planePointer to normalized plane.
[in]aPointer to first point.
[in]bPointer to second point.
[in]cPointer to third point.

return

  • 0 on success
  • -1 on fail (when points are colinear)

◆ PTK_Plane_projectPoint()

void PTK_Plane_projectPoint ( PTK_Plane plane,
PTK_Point proj,
PTK_Point point 
)

Project 3D point onto the plane.

Parameters
[out]planePointer to normalized plane
[in]pointPointer to point to be projected
[out]projPointer to projected point on the plane. Can be same as point.