git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1376 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -169,12 +169,6 @@ TwoD<numtyp> TwoD<numtyp>::normal() {
|
|||||||
return TwoD(y,x*numtyp(-1));
|
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>
|
template<class numtyp>
|
||||||
numtyp TwoD<numtyp>::dist2(const TwoD<numtyp> &two) const {
|
numtyp TwoD<numtyp>::dist2(const TwoD<numtyp> &two) const {
|
||||||
TwoD diff=*this-two;
|
TwoD diff=*this-two;
|
||||||
@ -293,26 +287,6 @@ template<class numtyp>
|
|||||||
ThreeD<numtyp>::ThreeD() {
|
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>
|
template<class numtyp>
|
||||||
void ThreeD<numtyp>::operator = (const ThreeD &two) {
|
void ThreeD<numtyp>::operator = (const ThreeD &two) {
|
||||||
#ifdef NANCHECK
|
#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);
|
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
|
// Move coordinates into array
|
||||||
template<class numtyp>
|
template<class numtyp>
|
||||||
void ThreeD<numtyp>::to_array(numtyp *array) {
|
void ThreeD<numtyp>::to_array(numtyp *array) {
|
||||||
@ -499,27 +468,12 @@ numtyp ThreeD<numtyp>::norm2() const {
|
|||||||
return x*x+y*y+z*z;
|
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>
|
template <class numtyp>
|
||||||
numtyp ThreeD<numtyp>::dist2(const ThreeD<numtyp> &two) {
|
numtyp ThreeD<numtyp>::dist2(const ThreeD<numtyp> &two) {
|
||||||
ThreeD diff=*this-two;
|
ThreeD diff=*this-two;
|
||||||
return diff.dot(diff);
|
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
|
// Return unit vector
|
||||||
template<class numtyp>
|
template<class numtyp>
|
||||||
ThreeD<numtyp> ThreeD<numtyp>::unit() {
|
ThreeD<numtyp> ThreeD<numtyp>::unit() {
|
||||||
|
|||||||
@ -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);
|
||||||
friend ThreeD<numtyp> operator/ <>(const numtyp, const ThreeD<numtyp> &two);
|
friend ThreeD<numtyp> operator/ <>(const numtyp, const ThreeD<numtyp> &two);
|
||||||
|
|
||||||
numtyp &operator[](unsigned i);
|
inline numtyp &operator[](unsigned i) {
|
||||||
numtyp operator[](unsigned i) const;
|
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;
|
||||||
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 ThreeD &two);
|
||||||
void operator -= (const numtyp &two);
|
void operator -= (const numtyp &two);
|
||||||
void operator -= (const ThreeD &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);
|
void operator /= (const numtyp &two);
|
||||||
|
|
||||||
/// Move coordinates into array
|
/// Move coordinates into array
|
||||||
@ -253,11 +271,20 @@ class ThreeD {
|
|||||||
/// Magnitude of vector
|
/// Magnitude of vector
|
||||||
numtyp hypot() const;
|
numtyp hypot() const;
|
||||||
/// Distance between two points
|
/// 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
|
/// Distance squared between two points
|
||||||
numtyp dist2(const ThreeD<numtyp> &two);
|
numtyp dist2(const ThreeD<numtyp> &two);
|
||||||
/// Converts \b *this to the unit vector
|
/// 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
|
/// Return the unit vector of \b *this
|
||||||
ThreeD<numtyp> unit();
|
ThreeD<numtyp> unit();
|
||||||
|
|
||||||
|
|||||||
@ -333,7 +333,8 @@ void GLSurface::write_vspheres(ofstream &out, const string &objname,
|
|||||||
writepymolheader(out);
|
writepymolheader(out);
|
||||||
for (i=0; i<vertices.size(); i++) {
|
for (i=0; i<vertices.size(); i++) {
|
||||||
// Output coords, colors, and normals of points
|
// Output coords, colors, and normals of points
|
||||||
// if (vertices[i].transparency!=1)
|
if (vertices[i].transparency==0)
|
||||||
|
continue;
|
||||||
out << "ALPHA," << vertices[i].transparency << ",";
|
out << "ALPHA," << vertices[i].transparency << ",";
|
||||||
out << "COLOR,";
|
out << "COLOR,";
|
||||||
for (k=X; k<=Z; k++)
|
for (k=X; k<=Z; k++)
|
||||||
@ -353,7 +354,8 @@ void GLSurface::writespheres(ofstream &out, const string &objname) {
|
|||||||
writepymolheader(out);
|
writepymolheader(out);
|
||||||
for (i=0; i<spheres.size(); i++) {
|
for (i=0; i<spheres.size(); i++) {
|
||||||
// Output coords, colors, and normals of points
|
// 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 << "ALPHA," << vertices[spheres[i].i].transparency << ",";
|
||||||
out << "COLOR,";
|
out << "COLOR,";
|
||||||
for (k=X; k<=Z; k++)
|
for (k=X; k<=Z; k++)
|
||||||
|
|||||||
Reference in New Issue
Block a user