Vec3Dpline Class Function Manual

(   )

| HOME | BACK |

Purpose

To get a value of an element at a particular index in a Vector.  The return result is a VecPt3D object.

The first element index is 0, and the last one is n-1, where n is no of total elements.

Class

Vec3Dpline

Usage

{VecPt3D} ret  =  object({int} argm1)

argm1 = index number

Example:

->v = Vec3Dpline()

->v.load("line_3d.txt")

->print v

Vector size : 3


Vec of 3D Point...

list id : 0

Vector size : 4

( 34.489 , 21.686 , -150.715)
( 34.607 , 21.669 , -150.690)
( 34.725 , 21.652 , -150.664)
( 34.844 , 21.634 , -150.639)


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)


->print v(0)

Vec of 3D Point...

list id : 0

Vector size : 4

( 34.489 , 21.686 , -150.715)
( 34.607 , 21.669 , -150.690)
( 34.725 , 21.652 , -150.664)
( 34.844 , 21.634 , -150.639)

->

See also (class function)

init

| HOME | BACK |


EXTEND

| HOME | BACK |

Purpose

To increase the maximum size of the vector by a given number.

Class

Vec3Dpline

Usage

{void} object.EXTEND({int} argm1)

argm1 = number of elements wanted to extend

Example:

->v = Vec3Dpline(5)

->v.maxsize()

  ans = 5

->v.extend(500)

->v.maxsize()

  ans = 505

->

See also (class function)

maxsize, truncate

| HOME | BACK |


FIND

| HOME | BACK |

Purpose

To find in a particular poly-line, a VecPt2D object, in a vector.  Two poly-line objects are the same if their ID number are the same, thus content of poly-lines plays no roll.

The return result is an index of the vector, if found, otherwise it returns -1.

Class

Vec3Dpline

Usage

{int} ret  =  object.FIND({VecPt3D} argm1)

argm1 = polyline wanted to find

Example:

->print v

Vector size : 3


Vec of 3D Point...

list id : 0

Vector size : 4

( 34.489 , 21.686 , -150.715)
( 34.607 , 21.669 , -150.690)
( 34.725 , 21.652 , -150.664)
( 34.844 , 21.634 , -150.639)


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)


->pline = VecPt3D()

->pline.id() = 1

->v.find(pline)

ans = 1

->

See also (class function)

 

| HOME | BACK |


INIT

| HOME | BACK |

Purpose

To initialize a vector object. 

Please be aware that once the vector is initialized, it is still empty.  Only its maximum number of element in the vector is declared.  Use function "pushback" to insert element into a vector.

Class

Vec3Dpline

Usage

{void} object.INIT({int} argm1)

argm1 = number of maximum elements in the vector

Example:

->v = Vec3Dpline()

->v.init(500)

->

See also (class function)

pushback

| HOME | BACK |


LAST

| HOME | BACK |

Purpose

To get the last poly-line from the vector.

Class

Vec3Dpline

Usage

{VecIndx} ret  =  object.LAST()

Example:

->print v

Vector size : 3


Vec of 3D Point...

list id : 0

Vector size : 4

( 34.489 , 21.686 , -150.715)
( 34.607 , 21.669 , -150.690)
( 34.725 , 21.652 , -150.664)
( 34.844 , 21.634 , -150.639)


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)


->print v.last()

Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)

->

See also (class function)

 

| HOME | BACK |


LOAD

| HOME | BACK |

Purpose

To read data from an ASCII file and stored in a VecRCpline object.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of an ASCII data file is ".txt".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

It is important to make sure that the poly-line ID appears right before the data.  Each data line has exactly 3 fields, the first is for x coordinate, the second is for y coordinate, and the last field is for z coordinate.   All of them are separated by at least one blank, a white space, ASCII 32.

It is possible to have a comment line in the data file, by inserting a slash sign, "/", in front of a line.  Comment lines will not be read by the function.

The following is an example of 3 poly-lines stored in a file.

/ List of Vector of 3D-Point (3D Polyline)


/ Polyline ID

/ x y z

/ ...



0
34.489 21.686 -150.715
34.607 21.669 -150.690
34.725 21.652 -150.664
34.844 21.634 -150.639



1
42.412 24.412 -149.735
42.412 24.398 -149.735
42.412 24.385 -149.735
42.405 24.367 -149.710


2
34.742 25.436 -149.784
34.852 25.422 -149.784
34.962 25.408 -149.784
35.077 25.399 -149.809
35.187 25.385 -149.809
35.311 25.371 -149.809

Class

Vec3Dpline

Usage

{void} object.LOAD({String} argm1)

argm1 = data filename (default extension is ".txt")

Example:

->v = Vec3Dpline()

->v.load("my_data")

->

See also (class function)

save

| HOME | BACK |


MAX

| HOME | BACK |

Purpose

To report the maximum x, y, z coordinate in the vector by searching through all poly-lines in the vector.

Class

Vec3Dpline

Usage

{Pt3D} ret  =  object.MAX()

Example:

->max_pt = v.max()

->print max_pt

  (2505.002, 4508.009, 25.896)

->

See also (class function)

min

| HOME | BACK |


MAXSIZE

| HOME | BACK |

Purpose

To report the maximum size of the vector.  This is the maximum number of elements that can be stored in the vector.

Class

Vec3Dpline

Usage

{int} ret  =  object.MAXSIZE()

Example:

->v = Vec3Dpline(5)

->v.maxsize()

  ans =   5

->

See also (class function)

size, truncate, extend

| HOME | BACK |


MIN

| HOME | BACK |

Purpose

To report the minimum x, y, z coordinate in the vector by searching through all poly-lines in the vector.

Class

Vec3Dpline

Usage

{Pt3D} ret  =  object.MAX()

Example:

->min_pt = v.min()

->print min_pt

  (0.002, 8.009, 0.006)

->

See also (class function)

min

| HOME | BACK |


PUSHBACK

| HOME | BACK |

Purpose

To insert a poly-line, a VecPt2D object in a vector object.  A new element will be insert at the last available index in the vector.

Suppose the vector has already 4 element in it, when a new element is inserted, the size is updated to 5 and the new element is stored at index number 4.  The first element index is 0, and the last one is n-1, where n is no of total elements.

Class

Vec3Dpline

Usage

{void} object.PUSHBACK({VecPt2D} argm1)

argm1 = poly-line being inserted

Example:

->print pline

Vec of 3D Point...

list id : 0

Vector size : 4

( 34.489 , 21.686 , -150.715)
( 34.607 , 21.669 , -150.690)
( 34.725 , 21.652 , -150.664)
( 34.844 , 21.634 , -150.639)

->v = Vec3Dpline(5)

->v.pushback(pline)

->print v

Vector size : 1


Vec of 3D Point...

list id : 0

Vector size : 4

( 34.489 , 21.686 , -150.715)
( 34.607 , 21.669 , -150.690)
( 34.725 , 21.652 , -150.664)
( 34.844 , 21.634 , -150.639)


->

See also (class function)

init

| HOME | BACK |


QFIND

| HOME | BACK |

Purpose

To find in a particular poly-line, a VecPt3D object, in a vector.  Two poly-line objects are the same if their ID number are the same, thus content of poly-lines plays no roll.

This function expects that the content of the vector is already sorted, or otherwise it will not work correctly.

It performs a binary searching which is much faster than using the function "find".

The return result is an index of the vector, if found, otherwise it returns -1.

Class

Vec3Dpline

Usage

{int} ret  =  object.QFIND({VecPt3D} argm1)

argm1 = poly-line wanted to find

Example:- see class function "find"

->

->

See also (class function)

find

| HOME | BACK |


REMALL

| HOME | BACK |

Purpose

To empty the content of the vector. 

This function can be used to reset the vector very quick.  It simply sets the size of the vector to zero.  It does not do any memory initialization.

Class

Vec3Dpline

Usage

{void} object.REMALL()

Example:

->print v

Vector size : 3


Vec of 3D Point...

list id : 0

Vector size : 4

( 34.489 , 21.686 , -150.715)
( 34.607 , 21.669 , -150.690)
( 34.725 , 21.652 , -150.664)
( 34.844 , 21.634 , -150.639)


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)


->v.remall()

->print v

->

See also (class function)

remove

| HOME | BACK |


REMOVE

| HOME | BACK |

Purpose

To remove an element at a particular index out of the vector.

This function replaces the content at the required index with the last element, and simply reduces the size of the vector by 1.

Class

Vec3Dpline

Usage

{void} object.REMOVE({int} argm1)

argm1 = index at which the element being removed

Example:

->print v

Vector size : 3


Vec of 3D Point...

list id : 0

Vector size : 4

( 34.489 , 21.686 , -150.715)
( 34.607 , 21.669 , -150.690)
( 34.725 , 21.652 , -150.664)
( 34.844 , 21.634 , -150.639)


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)


->v.remove(0)

->print v

Vector size : 2


Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


->

See also (class function)

remall

| HOME | BACK |


REVERSE

| HOME | BACK |

Purpose

To reverse the order of the content of the vector.  The last poly-line becomes the first element and the first poly-line becomes the last element of the vector.

Class

Vec3Dpline

Usage

{VecRCpline} ret = object.REVERSE()

Example:

->print v

Vector size : 2


Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)




Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)






->v1 = v.reverse()
->print v1

Vector size : 2


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)




Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)






->

See also (class function)

remall, remove

| HOME | BACK |


SAVE

| HOME | BACK |

Purpose

To save as ASCII format.  Each block in the output file represents an element, a poly-line, in the vector.

if a file name extension is not given, the function assumes an extension of ".txt".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Vec3Dpline

Usage

{void} object.SAVE({String} argm1)

argm1 = output file name

Example:

->v.save("my_data")

->

See also (class function)

load

| HOME | BACK |


SAVEWRL

| HOME | BACK |

Purpose

To save as WRL (world file) format, a file format used in Virtual Reality Modeling language (VRML). 

if a file name extension is not given, the function assumes an extension of ".wrl".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

The function can save the data as a set of faces (planes) or a set of lines.  By selecting "F" for faces, the program will treat each polyline as a closed polygon, representing a planar surface.

Class

Vec3Dpline

Usage

{void} object.SAVEWRL({String} argm1, [{String} argm2])

argm1 = output file name

argm2 = an option, must be either "F" or "L"

        (default = "F", face)

Example:

->v.savewrl("My_3Dline")

->

See also (class function)

save

| HOME | BACK |


SIZE

| HOME | BACK |

Purpose

To report the current size of the vector.  This is the current number of elements in the vector.

Class

Vec3Dpline

Usage

{int} ret  =  object.SIZE()

Example:

->v = Vec3Dpline(5)

->v.size()

  ans =   0

->

See also (class function)

maxsize, truncate, extend

| HOME | BACK |


SMOOTH

| HOME | BACK |

Purpose

To smooth all 3D poly-lines in the vector.

The algorithm used here is Douglas-Peucker in 3D space.

The user is required to provide a tolerant distance, which is used to determine whether a vertex will be include in the smooth version of the line.  A vertex is discarded if the distance from it to the line is less than the given tolerance.

Class

Vec3Dpline

Usage

{Vec3Dpline} ret = object.SMOOTH({double} argm1)

argm1 = tolerant distance (in pixel unit)

Example:

->print v

Vector size : 2


Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


->v1 = v.smooth(.2)

->print v1

Vector size : 2


Vec of 3D Point...

list id : 2

Vector size : 2

( 34.742 , 25.436 , -149.784)
( 35.311 , 25.371 , -149.809)


Vec of 3D Point...

list id : 1

Vector size : 2

( 42.412 , 24.412 , -149.735)
( 42.405 , 24.367 , -149.710)


->

See also (class function)

 

| HOME | BACK |


SORT

| HOME | BACK |

Purpose

To sort poly-lines in a vector.  Poly-lines are sorted from minimum to maximum according to their ID.

Class

Vec3Dpline

Usage

{Vec3Dpline} ret = object.SORT()

Example:

->v2 = v1.sort()

->

See also (class function)

qfind

| HOME | BACK |


TRUNCATE

| HOME | BACK |

Purpose

To trim out all the empty space of the current vector.

Suppose a vector has 5 elements in it, and its max size is 500, once it is trimmed, the max size is reduced to 5.  This function does a new memory initialization.

Class

Vec3Dpline

Usage

{void} object.TRUNCATE()

argm1 = number of elements wanted to extend

Example:

->v = Vec3Dpline(5)

->v.maxsize()

  ans = 5

->v.truncate()

->v.maxsize()

  ans = 0

->

See also (class function)

maxsize, extend

| HOME | BACK |


UNSTACK

| HOME | BACK |

Purpose

To get the last poly-line from the vector, as well as remove it from the vector.  Hence the size of the vector, the calling object, gets reduced by 1.

Class

Vec3Dpline

Usage

{VecPt2D} ret  =  object.UNSTACK()

Example:

->print v

Vector size : 2


Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


->pline = v.unstack()

->print pline

Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


->print v.size()

   1

->

See also (class function)

 

| HOME | BACK |


WINDOW

| HOME | BACK |

Purpose

To extract a portion of a vector, specified by a starting index and ending index.

Class

Vec3Dpline

Usage

{VecXYpline} ret  =  object.WINDOW({int} argm1,{int} argm2)

argm1 = start index at which the element being extracted

argm2 = ending index at which the element being extracted

Example:

->print v

Vector size : 3


Vec of 3D Point...

list id : 0

Vector size : 4

( 34.489 , 21.686 , -150.715)
( 34.607 , 21.669 , -150.690)
( 34.725 , 21.652 , -150.664)
( 34.844 , 21.634 , -150.639)


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


Vec of 3D Point...

list id : 2

Vector size : 6

( 34.742 , 25.436 , -149.784)
( 34.852 , 25.422 , -149.784)
( 34.962 , 25.408 , -149.784)
( 35.077 , 25.399 , -149.809)
( 35.187 , 25.385 , -149.809)
( 35.311 , 25.371 , -149.809)


->v1 = v.window(0,1)

->print v1

Vector size : 2


Vec of 3D Point...

list id : 0

Vector size : 4

( 34.489 , 21.686 , -150.715)
( 34.607 , 21.669 , -150.690)
( 34.725 , 21.652 , -150.664)
( 34.844 , 21.634 , -150.639)


Vec of 3D Point...

list id : 1

Vector size : 4

( 42.412 , 24.412 , -149.735)
( 42.412 , 24.398 , -149.735)
( 42.412 , 24.385 , -149.735)
( 42.405 , 24.367 , -149.710)


->

See also (class function)

last, unstack

| HOME | BACK |


WINDOW_XY

| HOME | BACK |

Purpose

To extract poly-lines that are within the region of a specified window

Class

Vec3Dpline

Usage

{VecRCpline} ret  =  object.WINDOW_XY({double} argm1,{double} argm2, {double} argm3,{double} argm4)

argm1 = x coordinate of the lower left corner of the window

argm2 = y coordinate of the lower left corner of the window

argm3 = x coordinate of the upper right corner of the window

argm4 = y coordinate of the upper right corner of the window

Example:

->v2 = v1.window_xy(10,10,250,250)


->

See also (class function)

window

| HOME | BACK |