3D Position Vectors
Site Map Feedback

Download:

Up gCoord Points Vectors PV Planes

 g3PV and g2PV each have a Point and a Vector.

 g2PV may describe a Line or an axially-aligned Rectangle (P is one corner, V is the diagonal extents).

 g3PV may describe a Plane (P as the Local Origin, V as the Normal), or axially-aligned Cuboid (P is one corner, V is the diagonal extents).

 g3PV::GetPlaneOrigin returns the point on the Plane which is closest to the Global Origin. If you are creating a lot of planes where the position of the origin isn't critical, creating the origin in a default place like this helps you know when the plane you have just created is identical to an existing plane. The constructors have a boolean, NormalisePlaneOrigin parameter which allows you to create the PV with it's origin moved to the closest point on its plane to the Global Origin.

 g3PV has lots of test methods, for example HitLine, HitInfiniteLine and HitPlane which are all tests for a point, but this PV is representing different objects... This PV class is not type-safe: it's presented as a primitive, like int, it's up to the programmer to decide what the value represents. Similarly, some methods expect the Vector to be normalised before you call them! So read the comments by each method, appreciate that this class is the most useful of all the primitives, but that you need to give your PV instances clear names that indicate the type, for example g3PV ArmPlane or g3PV BoundsBox.


THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


 (2375) Last modified: Thu, 28 May 2009 08:59:07 +0100