Skip to content

LineSource

Introduction

vtkLineSource creates a line segment from point1 to point2; The resolution can be specified, which determines the number of points along the line. Following a vtkLineSource by a vtkTubeFilter is a convenient way to create a cylinder based on endpoints.

Usage

js
import vtkLineSource from '@kitware/vtk.js/Filters/Sources/LineSource';

const line = vtkLineSource.newInstance({ resolution: 10 });
const polydata = line.getOutputData();

Methods

extend

Method used to decorate a given object (publicAPI+model) with vtkLineSource characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesILineSourceInitialValuesNo(default: {})

getPoint1

Get the starting point of the line.

getPoint1ByReference

Get the starting point of the line.

getPoint2

Get the ending point of the line.

getPoint2ByReference

Get the ending point of the line.

getResolution

Get the resolution of the line.

newInstance

Method used to create a new instance of vtkLineSource.

ArgumentTypeRequiredDescription
initialValuesILineSourceInitialValuesNofor pre-setting some of its content

requestData

ArgumentTypeRequiredDescription
inDataYes
outDataYes

setPoint1

Set the starting point of the line.

ArgumentTypeRequiredDescription
point1Vector3YesThe starting point's coordinates.

setPoint1

Set the starting point of the line.

ArgumentTypeRequiredDescription
xNumberYesThe x coordinate.
yNumberYesThe y coordinate.
zNumberYesThe z coordinate.

setPoint1From

Set the starting point of the line.

ArgumentTypeRequiredDescription
point1Vector3YesThe starting point's coordinates.

setPoint2

Set the ending point of the line.

ArgumentTypeRequiredDescription
xNumberYesThe x coordinate.
yNumberYesThe y coordinate.
zNumberYesThe z coordinate.

setPoint2From

Set the ending point of the line.

ArgumentTypeRequiredDescription
point2Vector3YesThe ending point's coordinates.

setResolution

Set the number of segments used to represent the line.

ArgumentTypeRequiredDescription
resolutionNumberYesThe number of segments.