Kstars

SpatialConstraint.cpp
1 //# Filename: SpatialConstraint.cpp
2 //#
3 //# The SpatialConstraint, SpatialSign
4 //# classes are defined here.
5 //#
6 //# Author: Peter Z. Kunszt based on A. Szalay's code
7 //#
8 //# Date: October 23, 1998
9 //#
10 //# SPDX-FileCopyrightText: 2000 Peter Z. Kunszt Alex S. Szalay, Aniruddha R. Thakar
11 //# The Johns Hopkins University
12 //#
13 //# Modification History:
14 //#
15 //# Oct 18, 2001 : Dennis C. Dinge -- Replaced ValVec with std::vector
16 //#
17 
18 #include "SpatialConstraint.h"
19 #include "SpatialException.h"
20 
21 // ===========================================================================
22 //
23 // Member functions for class SpatialConstraint
24 //
25 // ===========================================================================
26 
27 /////////////CONSTRUCTOR//////////////////////////////////
28 //
30 {
31  a_.normalize();
32  s_ = acos(d_);
33  if (d_ <= -gEpsilon)
34  sign_ = nEG;
35  if (d_ >= gEpsilon)
36  sign_ = pOS;
37 }
38 
39 /////////////CONTAINS/////////////////////////////////////
40 // check whether a vector is inside this
41 //
43 {
44  return acos(v * a_) < s_;
45 }
void normalize()
Normalize vector length to 1.
SpatialConstraint()
Constructor.
SpatialVector & v()
give back vector
bool contains(const SpatialVector v)
check whether a vector is inside this
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Aug 11 2022 04:00:06 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.