0
|
1 NAME
|
|
2 Vector
|
|
3
|
|
4 SYNOPSIS
|
|
5 use Vector;
|
|
6
|
|
7 use Vector qw(:all);
|
|
8
|
|
9 DESCRIPTION
|
|
10 Vector class provides the following methods:
|
|
11
|
|
12 new, AddValues, Copy, GetLength, GetMagnitude, GetNumOfNonZeroValues,
|
|
13 GetPercentOfNonZeroValues, GetSize, GetValue, GetValues, GetX, GetXYZ,
|
|
14 GetY, GetZ, IsVector, Normalize, SetValue, SetValuePrintFormat, SetX,
|
|
15 SetXYZ, SetY, SetZ, StringifyVector, IsVector
|
|
16
|
|
17 The following functions are available:
|
|
18
|
|
19 IsVector, SetValuePrintFormat UnitXVector, UnitYVector, UnitZVector,
|
|
20 UnitVector, ZeroVector
|
|
21
|
|
22 The following operators are overloaded:
|
|
23
|
|
24 "" 0+ bool
|
|
25 @{}
|
|
26 + - * / %
|
|
27 x .
|
|
28 == != < <= > >=
|
|
29 neg
|
|
30 abs exp log sqrt cos sin
|
|
31
|
|
32 FUNCTIONS
|
|
33 new
|
|
34 $NewVector = new Vector();
|
|
35 $NewVector = new Vector(@Values);
|
|
36 $NewVector = new Vector(\@Values);
|
|
37 $NewVector = new Vector($AnotherVector);
|
|
38
|
|
39 Creates a new Vector object containing *Values* and returns
|
|
40 NewVector object. In case no *Values* are specified, an empty Vector
|
|
41 is created.
|
|
42
|
|
43 AddValues
|
|
44 $Vector->AddValues(@Values);
|
|
45 $Vector->AddValues(\@Values);
|
|
46 $Vector->AddValues($AnotherVector);
|
|
47
|
|
48 Adds values to *Vector* using an array, reference to an array or
|
|
49 another vector and returns *Vector*.
|
|
50
|
|
51 Copy
|
|
52 $NewVector = $Vector->Copy();
|
|
53
|
|
54 Creates a copy of *Vector* and returns *NewVector*.
|
|
55
|
|
56 GetLength
|
|
57 $Length = $Vector->GetLength();
|
|
58
|
|
59 Returns *Lengh* of a 3D *Vector* corresponding to its dot product.
|
|
60
|
|
61 GetMagnitude
|
|
62 $Length = $Vector->GetMagnitude();
|
|
63
|
|
64 Returns *Lengh* of a 3D *Vector* corresponding to its dot product.
|
|
65
|
|
66 GetNumOfNonZeroValues
|
|
67 $Value = $Vector->GetNumOfNonZeroValues();
|
|
68
|
|
69 Returns number of non-zero values in *Vector*.
|
|
70
|
|
71 GetPercentOfNonZeroValues
|
|
72 $Value = $Vector->GetPercentOfNonZeroValues();
|
|
73
|
|
74 Returns percent of non-zero values in *Vector*.
|
|
75
|
|
76 GetSize
|
|
77 $Size = $Vector->GetSize();
|
|
78
|
|
79 Returns size of a *Vector* corresponding to number of its values.
|
|
80
|
|
81 GetValue
|
|
82 $Value = $Vector->GetValues($Index);
|
|
83
|
|
84 Returns vector Value specified using *Index* starting at 0.
|
|
85
|
|
86 GetValues
|
|
87 @Values = $Vector->GetValues();
|
|
88 $ValuesRef = $Vector->GetValues();
|
|
89
|
|
90 Returns an array or a reference to an array containing all *Vector*
|
|
91 values.
|
|
92
|
|
93 GetX
|
|
94 $X = $Vector->GetX();
|
|
95
|
|
96 Returns X value of a 3D *Vector*
|
|
97
|
|
98 GetXYZ
|
|
99 @XYZValues = $Vector->GetXYZ();
|
|
100 $XYZValuesRef = $Vector->GetXYZ();
|
|
101
|
|
102 Returns XYZ values of a 3D *Vector* as an array or a reference to an
|
|
103 array containing the values.
|
|
104
|
|
105 GetY
|
|
106 $Y = $Vector->GetY();
|
|
107
|
|
108 Returns Y value of a 3D *Vector*.
|
|
109
|
|
110 GetZ
|
|
111 $Z = $Vector->GetZ();
|
|
112
|
|
113 Returns Z value of a 3D *Vector*.
|
|
114
|
|
115 IsVector
|
|
116 $Status = Vector::IsVector($Object);
|
|
117
|
|
118 Returns 1 or 0 based on whether *Object* is a Vector object.
|
|
119
|
|
120 Normalize
|
|
121 $Vector->Normalize();
|
|
122
|
|
123 Normalizes a 3D *Vector* by dividing its values by the length and
|
|
124 returns *Vector*.
|
|
125
|
|
126 SetValue
|
|
127 $Vector->SetValue($Index, $Value);
|
|
128
|
|
129 Sets a *Vector* value specified by *Index* to *Value* and returns
|
|
130 *Vector*.
|
|
131
|
|
132 SetValuePrintFormat
|
|
133 $Vector->SetValuePrintFormat($ValuePrintFormat);
|
|
134 Vector::SetValuePrintFormat($ValuePrintFormat);
|
|
135
|
|
136 Sets format for printing vector values for a specified *Vector* or
|
|
137 the whole class. Default format: *%g*.
|
|
138
|
|
139 SetX
|
|
140 $Vector->SetX($Value);
|
|
141
|
|
142 Sets X value of a 3D vector to *Value* and returns *Vector*.
|
|
143
|
|
144 SetXYZ
|
|
145 $Vector->SetXYZ(@Values);
|
|
146 $Vector->SetXYZ(\@Values);
|
|
147 $Vector->SetXYZ($AnotherVector);
|
|
148
|
|
149 Sets XYZ values of a 3D vector and returns *Vector*.
|
|
150
|
|
151 SetY
|
|
152 $Vector->SetY($Value);
|
|
153
|
|
154 Sets Y value of a 3D vector to *Value* and returns *Vector*.
|
|
155
|
|
156 SetZ
|
|
157 $Vector->SetZ($Value);
|
|
158
|
|
159 Sets Z value of a 3D vector to *Value* and returns *Vector*.
|
|
160
|
|
161 StringifyVector
|
|
162 $String = $Vector->StringifyVector();
|
|
163
|
|
164 Returns a string containing information about *Vector* object.
|
|
165
|
|
166 UnitVector
|
|
167 $UnitVector = UnitVector([$Size]);
|
|
168 $UnitVector = Vector::UnitVector([$Size]);
|
|
169
|
|
170 Returns a UnitVector of *Size*. Default size: *3*.
|
|
171
|
|
172 UnitXVector
|
|
173 $UnitXVector = UnitXVector();
|
|
174
|
|
175 Returns a 3D UnitXVector.
|
|
176
|
|
177 UnitYVector
|
|
178 $UnitYVector = UnitYVector();
|
|
179
|
|
180 Returns a 3D UnitYVector.
|
|
181
|
|
182 UnitZVector
|
|
183 $UnitZVector = UnitZVector();
|
|
184
|
|
185 Returns a 3D UnitZVector.
|
|
186
|
|
187 ZeroVector
|
|
188 $UnitVector = ZeroVector([$Size]);
|
|
189 $UnitVector = Vector::ZeroVector([$Size]);
|
|
190
|
|
191 Returns a ZeroVector of *Size*. Default size: *3*.
|
|
192
|
|
193 AUTHOR
|
|
194 Manish Sud <msud@san.rr.com>
|
|
195
|
|
196 SEE ALSO
|
|
197 BitVector.pm
|
|
198
|
|
199 COPYRIGHT
|
|
200 Copyright (C) 2015 Manish Sud. All rights reserved.
|
|
201
|
|
202 This file is part of MayaChemTools.
|
|
203
|
|
204 MayaChemTools is free software; you can redistribute it and/or modify it
|
|
205 under the terms of the GNU Lesser General Public License as published by
|
|
206 the Free Software Foundation; either version 3 of the License, or (at
|
|
207 your option) any later version.
|
|
208
|