SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
Public Member Functions | Static Public Member Functions | Data Fields | Friends
CW::Line3D Class Reference

#include <Geometry.hpp>

Public Member Functions

 Line3D ()
 
 Line3D (const Point3D point, const Vector3D direction)
 
 Line3D (const Vector3D direction, const Point3D point)
 
 Line3D (bool valid)
 
 Line3D (const Line3D &other)
 
Line3Doperator= (const Line3D &line)
 
bool operator! () const
 
Point3D intersection (const Line3D &line) const
 
Point3D intersection (const Plane3D &plane) const
 
Point3D intersection (const Point3D &point, const Vector3D &vector) const
 
std::pair< Point3D, Point3Dclosest_points (const Line3D &line) const
 
Point3D closest_point (const Point3D &point) const
 
double distance (const Point3D &point) const
 
bool on_line (const Point3D &point) const
 
bool parallel (const Line3D &line) const
 
bool parallel (const Vector3D &vector) const
 

Static Public Member Functions

static bool on_line_segment (const Point3D &point_a, const Point3D &point_b, const Point3D &test_point)
 

Data Fields

Point3Dpoint
 
Vector3Ddirection
 

Friends

bool operator== (const Line3D &lhs, const Line3D &rhs)
 

Detailed Description

A Line3D represents a point and a vector, which carries on into infinity in two directions. There is no equivalent native object in the Sketchup C API.

Definition at line 549 of file Geometry.hpp.

Constructor & Destructor Documentation

CW::Line3D::Line3D ( )

Line3D

Definition at line 1001 of file Geometry.cpp.

CW::Line3D::Line3D ( bool  valid)

Invaid, or NULL Line3D objects can be simulated with this constructor.

Parameters
valid- if true, a valid line will be created with a point and no direction.

Definition at line 1019 of file Geometry.cpp.

CW::Line3D::Line3D ( const Line3D other)

Copy constructor

Definition at line 1028 of file Geometry.cpp.

Member Function Documentation

Point3D CW::Line3D::closest_point ( const Point3D point) const

Return the closest point on the line to the point.

Parameters
point- the point for which to find the shortest point on the line
Returns
Point3D representing the point on this line, where it is closest to the target point.

Definition at line 1142 of file Geometry.cpp.

std::pair< Point3D, Point3D > CW::Line3D::closest_points ( const Line3D line) const

Return the closest points on two lines.

Parameters
other_linethe line with which to find the shortest.
Returns
pair of Point3D objects representing the point (first) on this line, and the point (second) on the other line. If the lines are parallel, the point3D objects returned will be invalid.

Definition at line 1098 of file Geometry.cpp.

double CW::Line3D::distance ( const Point3D point) const

Return the closest distance between the line and the given point.

Parameters
point- the point for which to find the shortest distance to the line
Returns
double distance between the point and line.

Definition at line 1157 of file Geometry.cpp.

Point3D CW::Line3D::intersection ( const Point3D point,
const Vector3D vector 
) const

Returns the intersection between this line and a line segment drawn between two points, given by a point and a vector from that point.

Parameters
point- point representing the start of the line segment.
vector- vector representing the direction and length of the line segment from the start point.
Returns
point3D object, representing the point of intersection. If there is no intersection between the line and the line segment, a null point3D object will be returned.
bool CW::Line3D::on_line ( const Point3D point) const

Check if point is on line.

Definition at line 1163 of file Geometry.cpp.

bool CW::Line3D::on_line_segment ( const Point3D point_a,
const Point3D point_b,
const Point3D test_point 
)
static

Check if a point lies on a line segment.

Parameters
point_a- the start point of the line segment.
point_b- the end point of the line segment.
test_point- the point to test.
Returns
true if the point lies between the line segment.

Definition at line 1213 of file Geometry.cpp.

bool CW::Line3D::operator! ( ) const

Comparative operators

Definition at line 1048 of file Geometry.cpp.

bool CW::Line3D::parallel ( const Line3D line) const

Returns true if the Line or vector given is parallel to this line.

Definition at line 1248 of file Geometry.cpp.

Friends And Related Function Documentation

bool operator== ( const Line3D lhs,
const Line3D rhs 
)
friend

Compares two lines if they represent the same line.

Definition at line 1284 of file Geometry.cpp.


The documentation for this class was generated from the following files: