| 196 |
|
} |
| 197 |
|
|
| 198 |
|
RealType angle = 0.0; |
| 199 |
+ |
RealType p4 = 0.0; |
| 200 |
|
|
| 201 |
|
if (doVect_) { |
| 202 |
|
for (sd = seleMan1_.beginSelected(ii); sd != NULL; |
| 204 |
|
if (sd->isDirectional()) { |
| 205 |
|
Vector3d vec = sd->getA().getColumn(2); |
| 206 |
|
vec.normalize(); |
| 207 |
< |
angle += acos(dot(vec, director)); |
| 207 |
> |
RealType myDot = dot(vec, director); |
| 208 |
> |
angle += acos(myDot); |
| 209 |
> |
p4 += (35.0 * pow(myDot, 4) - 30.0 * pow(myDot, 2) + 3.0) / 8.0; |
| 210 |
|
} |
| 211 |
|
} |
| 212 |
|
angle = angle/(seleMan1_.getSelectionCount()*NumericConstant::PI)*180.0; |
| 213 |
< |
|
| 213 |
> |
p4 /= (seleMan1_.getSelectionCount()); |
| 214 |
|
} else { |
| 215 |
|
for (vector<pair<StuntDouble*, StuntDouble*> >::iterator j = sdPairs_.begin(); j != sdPairs_.end(); ++j) { |
| 216 |
|
Vector3d vec = j->first->getPos() - j->second->getPos(); |
| 217 |
|
if (usePeriodicBoundaryConditions_) |
| 218 |
|
currentSnapshot_->wrapVector(vec); |
| 219 |
|
vec.normalize(); |
| 220 |
< |
angle += acos(dot(vec, director)) ; |
| 220 |
> |
RealType myDot = dot(vec, director); |
| 221 |
> |
angle += acos(myDot); |
| 222 |
> |
p4 += (35.0 * pow(myDot, 4) - 30.0 * pow(myDot, 2) + 3.0) / 8.0; |
| 223 |
|
} |
| 224 |
|
angle = angle / (sdPairs_.size() * NumericConstant::PI) * 180.0; |
| 225 |
+ |
p4 /= (seleMan1_.getSelectionCount()); |
| 226 |
|
} |
| 227 |
|
|
| 228 |
|
OrderParam param; |
| 229 |
|
param.p2 = p2; |
| 230 |
|
param.director = director; |
| 231 |
|
param.angle = angle; |
| 232 |
+ |
param.p4 = p4; |
| 233 |
|
|
| 234 |
|
orderParams_.push_back(param); |
| 235 |
|
|
| 247 |
|
if (!doVect_) { |
| 248 |
|
os << "selection2: (" << selectionScript2_ << ")\n"; |
| 249 |
|
} |
| 250 |
< |
os << "#p2\tdirector_x\tdirector_y\tdiretor_z\tangle(degree)\n"; |
| 250 |
> |
os << "#p2\tdirector_x\tdirector_y\tdiretor_z\tangle(degree)\t<p4>\n"; |
| 251 |
|
|
| 252 |
|
for (size_t i = 0; i < orderParams_.size(); ++i) { |
| 253 |
|
os << orderParams_[i].p2 << "\t" |
| 254 |
|
<< orderParams_[i].director[0] << "\t" |
| 255 |
|
<< orderParams_[i].director[1] << "\t" |
| 256 |
|
<< orderParams_[i].director[2] << "\t" |
| 257 |
< |
<< orderParams_[i].angle << "\n"; |
| 257 |
> |
<< orderParams_[i].angle << "\t" |
| 258 |
> |
<< orderParams_[i].p4 << "\n"; |
| 259 |
|
|
| 260 |
|
} |
| 261 |
|
|