File indexing completed on 2024-04-14 14:10:46
0001 //# Filename: SpatialConstraint.cpp 0002 //# 0003 //# The SpatialConstraint, SpatialSign 0004 //# classes are defined here. 0005 //# 0006 //# Author: Peter Z. Kunszt based on A. Szalay's code 0007 //# 0008 //# Date: October 23, 1998 0009 //# 0010 //# SPDX-FileCopyrightText: 2000 Peter Z. Kunszt Alex S. Szalay, Aniruddha R. Thakar 0011 //# The Johns Hopkins University 0012 //# 0013 //# Modification History: 0014 //# 0015 //# Oct 18, 2001 : Dennis C. Dinge -- Replaced ValVec with std::vector 0016 //# 0017 0018 #include "SpatialConstraint.h" 0019 #include "SpatialException.h" 0020 0021 // =========================================================================== 0022 // 0023 // Member functions for class SpatialConstraint 0024 // 0025 // =========================================================================== 0026 0027 /////////////CONSTRUCTOR////////////////////////////////// 0028 // 0029 SpatialConstraint::SpatialConstraint(SpatialVector a, float64 d) : a_(a), d_(d) 0030 { 0031 a_.normalize(); 0032 s_ = acos(d_); 0033 if (d_ <= -gEpsilon) 0034 sign_ = nEG; 0035 if (d_ >= gEpsilon) 0036 sign_ = pOS; 0037 } 0038 0039 /////////////CONTAINS///////////////////////////////////// 0040 // check whether a vector is inside this 0041 // 0042 bool SpatialConstraint::contains(const SpatialVector v) 0043 { 0044 return acos(v * a_) < s_; 0045 }