source: branches/blt4/packages/vizservers/nanovis/vrmath/LineSegment.cpp @ 3892

Last change on this file since 3892 was 3892, checked in by gah, 11 years ago
File size: 573 bytes
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (c) 2004-2013  HUBzero Foundation, LLC
4 *
5 * Author: Insoo Woo <iwoo@purdue.edu>
6 */
7
8#include <vrmath/LineSegment.h>
9#include <vrmath/Matrix4x4d.h>
10
11using namespace vrmath;
12
13LineSegment::LineSegment():
14    pos(0, 0, 0, 1), dir(0.0f, 0.0f, -1.0f), length(0.0f)
15{
16}
17
18void LineSegment::transform(const Matrix4x4d &mat, const LineSegment &seg)
19{
20    pos = mat.transform(seg.pos);
21
22    dir *= length;
23
24    dir = mat.transformVec(seg.dir);
25    length = dir.length();
26    dir = dir.normalize();
27}
Note: See TracBrowser for help on using the repository browser.