Commit 83ec8fbd authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1376 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 7a1d7a7f
Loading
Loading
Loading
Loading
+0 −46
Original line number Diff line number Diff line
@@ -169,12 +169,6 @@ TwoD<numtyp> TwoD<numtyp>::normal() {
	return TwoD(y,x*numtyp(-1));
}

template<class numtyp>
numtyp TwoD<numtyp>::dist(const TwoD<numtyp> &two) const {
	TwoD diff=*this-two;
	return numtyp(sqrt(double(diff.dot(diff))));
}

template<class numtyp>
numtyp TwoD<numtyp>::dist2(const TwoD<numtyp> &two) const {
	TwoD diff=*this-two;
@@ -293,26 +287,6 @@ template<class numtyp>
ThreeD<numtyp>::ThreeD() {
}

template<class numtyp>
numtyp & ThreeD<numtyp>::operator[](unsigned i) {
  switch(i) {
   case X: return x;
   case Y: return y;
   case Z: return z;
  }
  return x;
}

template<class numtyp>
numtyp ThreeD<numtyp>::operator[](unsigned i) const {
  switch(i) {
   case X: return x;
   case Y: return y;
   case Z: return z;
  }
  return x;
}

template<class numtyp>
void ThreeD<numtyp>::operator = (const ThreeD &two) {
  #ifdef NANCHECK
@@ -396,11 +370,6 @@ numtyp ThreeD<numtyp>::dot(const ThreeD<numtyp> &two) const {
	return (x*two.x+y*two.y+z*two.z);
}

template<class numtyp>
void ThreeD<numtyp>::operator *= (const numtyp &two) {
  x*=two; y*=two; z*=two;
}

// Move coordinates into array
template<class numtyp>
void ThreeD<numtyp>::to_array(numtyp *array) {
@@ -499,27 +468,12 @@ numtyp ThreeD<numtyp>::norm2() const {
  return x*x+y*y+z*z;
}

template <class numtyp>
numtyp ThreeD<numtyp>::dist(const ThreeD<numtyp> &two) {
  return (*this-two).norm();
}

template <class numtyp>
numtyp ThreeD<numtyp>::dist2(const ThreeD<numtyp> &two) {
	ThreeD diff=*this-two;
	return diff.dot(diff);
}

// For normalizing a vector
template<class numtyp>
void ThreeD<numtyp>::normalize() {
  numtyp temp=norm();
  #ifdef NANCHECK
  assert(temp!=0);
  #endif
  *this/=temp;
}

// Return unit vector
template<class numtyp>
ThreeD<numtyp> ThreeD<numtyp>::unit() {
+32 −5
Original line number Diff line number Diff line
@@ -204,8 +204,23 @@ class ThreeD {
  friend ThreeD<numtyp> operator* <>(const numtyp, const ThreeD<numtyp> &two);
  friend ThreeD<numtyp> operator/ <>(const numtyp, const ThreeD<numtyp> &two);

  numtyp &operator[](unsigned i);
  numtyp operator[](unsigned i) const;
  inline numtyp &operator[](unsigned i) {
    switch(i) {
    case X: return x;
    case Y: return y;
    case Z: return z;
    }
    return x;
  }

  inline numtyp operator[](unsigned i) const {
    switch(i) {
    case X: return x;
    case Y: return y;
    case Z: return z;
    }
    return x;
  }

  bool operator == (const ThreeD<numtyp> &two) const;
  bool operator != (const ThreeD<numtyp> &two) const;
@@ -222,7 +237,10 @@ class ThreeD {
  void operator += (const ThreeD &two);
  void operator -= (const numtyp &two);
  void operator -= (const ThreeD &two);
  void operator *= (const numtyp &two);
  inline void operator *= (const numtyp &two) {
    x*=two; y*=two; z*=two;
  }

  void operator /= (const numtyp &two);

  /// Move coordinates into array
@@ -253,11 +271,20 @@ class ThreeD {
  /// Magnitude of vector
  numtyp hypot() const;
  /// Distance between two points
  numtyp dist(const ThreeD<numtyp> &two);
  inline numtyp dist(const ThreeD<numtyp> &two) {
    return (*this-two).norm();
  }
  /// Distance squared between two points
  numtyp dist2(const ThreeD<numtyp> &two);
  /// Converts \b *this to the unit vector
  void normalize();
  inline void normalize() {
    numtyp temp=norm();
    #ifdef NANCHECK
    assert(temp!=0);
    #endif
    *this/=temp;
  }

  /// Return the unit vector of \b *this
  ThreeD<numtyp> unit();

+4 −2
Original line number Diff line number Diff line
@@ -333,7 +333,8 @@ void GLSurface::write_vspheres(ofstream &out, const string &objname,
  writepymolheader(out);
  for (i=0; i<vertices.size(); i++) {
    // Output coords, colors, and normals of points
//    if (vertices[i].transparency!=1)
    if (vertices[i].transparency==0)
      continue;
      out << "ALPHA," << vertices[i].transparency << ",";
    out << "COLOR,";
    for (k=X; k<=Z; k++)
@@ -353,7 +354,8 @@ void GLSurface::writespheres(ofstream &out, const string &objname) {
  writepymolheader(out);
  for (i=0; i<spheres.size(); i++) {
    // Output coords, colors, and normals of points
//    if (vertices[i].transparency!=1)
    if (vertices[i].transparency==0)
      continue;
      out << "ALPHA," << vertices[spheres[i].i].transparency << ",";
    out << "COLOR,";
    for (k=X; k<=Z; k++)