• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • ekos
  • guide
vect.cpp
Go to the documentation of this file.
1 /* Ekos guide tool
2  Copyright (C) 2012 Andrew Stepanenko
3 
4  Modified by Jasem Mutlaq <mutlaqja@ikarustech.com> for KStars.
5 
6  This application is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10  */
11 
12 //---------------------------------------------------------------------------
13 #include "vect.h"
14 
15 #include <math.h>
16 #include <stdlib.h>
17 
18 //---------------------------------------------------------------------------
19 
20 
21 Vector operator ^ (const Vector& u, const Vector& v)
22 {
23  return Vector ( u.y*v.z - u.z*v.y,
24  u.z*v.x - u.x*v.z,
25  u.x*v.y - u.y*v.x
26  );
27 }
28 
29 Vector RndVector ()
30 {
31  Vector v (rand() - 0.5*RAND_MAX, rand() - 0.5*RAND_MAX,
32  rand() - 0.5*RAND_MAX
33  );
34  return Normalize( v );
35 }
36 
37 Vector& Clip( Vector& v)
38 {
39  if( v.x < 0.0 ) v.x = 0.0;
40  else
41  if( v.x > 1.0 ) v.x = 1.0;
42  if( v.y < 0.0 ) v.y = 0.0;
43  else
44  if( v.y > 1.0 ) v.y = 1.0;
45  if( v.z < 0.0 ) v.z = 0.0;
46  else
47  if( v.z > 1.0 ) v.z = 1.0;
48 
49  return v;
50 }
51 
52 
53 
54 
55 
56 
57 
58 
RndVector
Vector RndVector()
Definition: vect.cpp:29
Vector::x
double x
Definition: vect.h:21
Clip
Vector & Clip(Vector &v)
Definition: vect.cpp:37
Vector
Definition: vect.h:18
operator^
Vector operator^(const Vector &u, const Vector &v)
Definition: vect.cpp:21
vect.h
Vector::z
double z
Definition: vect.h:21
Normalize
Vector Normalize(const Vector &v)
Definition: vect.h:158
Vector::y
double y
Definition: vect.h:21
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal