faunus
Functions
Faunus::SpheroCylinder Namespace Reference

The algorithms found here are mainly direct conversions from Robert Vacha's spherocylinder C code (~2008-2010). More...

Functions

Point mindist_segment2segment (const Point &dir1, double halfl1, const Point &dir2, double halfl2, const Point &r_cm)
 Calculate minimum distance between two line segments. More...
 
int find_intersect_plane (const Cigar &part1, const Cigar &part2, const Point &r_cm, const Point &w_vec, double cutoff_squared, double cospatch, std::array< double, 5 > &intersections)
 Finds intersections of spherocylinder and plane defined by vector "w_vec" and if they are in all-way patch then returns number of them (PSC) More...
 
int test_intrpatch (const Cigar &part1, Point &vec, double cospatch, double ti, std::array< double, 5 > &intersections)
 Finds if vector "vec" has angular intersection w. More...
 
int find_intersect_planec (const Cigar &part1, const Cigar &part2, const Point &r_cm, const Point &w_vec, double rcut2, double cospatch, std::array< double, 5 > &intersections)
 Intersect of plane. More...
 
int psc_intersect (const Cigar &particle1, const Cigar &particle2, const Point &r_cm, std::array< double, 5 > &intersections, double cutoff_squared)
 Intersections of spherocylinder2 with a all-way patch of spherocylinder1 and return them (PSC) More...
 
int cpsc_intersect (const Cigar &part1, const Cigar &part2, const Point &r_cm, std::array< double, 5 > &intersections, double rcut2)
 Intersection of PSC2 with cylindrical patch of PSC1 and return them (CPSC) More...
 
Point vec_perpproject (const Point &a, const Point &b)
 Calculate perpendicular projection of the first vector versus the second vector. More...
 
Point mindist_segment2point (const Point &segment_direction, const double half_length, const Point &separation)
 
double fanglscale (const double a, const Cigar &cigar)
 

Detailed Description

The algorithms found here are mainly direct conversions from Robert Vacha's spherocylinder C code (~2008-2010).

Todo:
cleanup and split into smaller functions.

Function Documentation

◆ cpsc_intersect()

int Faunus::SpheroCylinder::cpsc_intersect ( const Cigar cigar1,
const Cigar cigar2,
const Point r_cm,
std::array< double, 5 > &  intersections,
const double  cutoff_squared 
)

Intersection of PSC2 with cylindrical patch of PSC1 and return them (CPSC)

Parameters
cigar1
cigar2
r_cm
intersections
cutoff_squared
Returns

◆ find_intersect_plane()

int Faunus::SpheroCylinder::find_intersect_plane ( const Cigar part1,
const Cigar part2,
const Point r_cm,
const Point w_vec,
const double  cutoff_squared,
const double  cospatch,
std::array< double, 5 > &  intersections 
)

Finds intersections of spherocylinder and plane defined by vector "w_vec" and if they are in all-way patch then returns number of them (PSC)

Parameters
part1Particle 1
part2Particle 2
r_cm
w_vec
cutoff_squared
cospatch
intersections
Returns

◆ find_intersect_planec()

int Faunus::SpheroCylinder::find_intersect_planec ( const Cigar part1,
const Cigar part2,
const Point r_cm,
const Point w_vec,
double  rcut2,
double  cospatch,
std::array< double, 5 > &  intersections 
)

Intersect of plane.

Parameters
part1
part2
r_cm
w_vec
rcut2
cospatch
intersections
Returns

Finds intersections of plane defined by vector "w_vec" and if they are in cylindrical patch then returns number of them (CPSC)

◆ mindist_segment2point()

Point Faunus::SpheroCylinder::mindist_segment2point ( const Point segment_direction,
const double  half_length,
const Point separation 
)
inline
Parameters
segment_directionDirection of segment
half_lengthHalf length of segment
separationDistance vector between the middle segment to point

◆ mindist_segment2segment()

Point Faunus::SpheroCylinder::mindist_segment2segment ( const Point dir1,
const double  half_length1,
const Point dir2,
const double  half_length2,
const Point r_cm 
)

Calculate minimum distance between two line segments.

Parameters
dir1
half_length1
dir2
half_length2
r_cm
Returns

Find closest distance between line segments and return its vector gets orientations and lengths of line segments and the vector connecting their center os masses (from vec1 to vec2) Copyright 2001, softSurfer (www.softsurfer.com) This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for their application.

Parameters
dir1Direction of first segment
halfl1Half length of first segment
dir2Direction of second segment
halfl2Half length of second segment
r_cmDistance vector between the middle of the two segments

◆ psc_intersect()

int Faunus::SpheroCylinder::psc_intersect ( const Cigar particle1,
const Cigar particle2,
const Point r_cm,
std::array< double, 5 > &  intersections,
const double  cutoff_squared 
)

Intersections of spherocylinder2 with a all-way patch of spherocylinder1 and return them (PSC)

Parameters
particle1
particle2
r_cm
intersections
cutoff_squared
Returns
Todo:
Add documentation and split into smaller parts(!)

◆ test_intrpatch()

int Faunus::SpheroCylinder::test_intrpatch ( const Cigar part1,
Point vec,
double  cospatch,
double  ti,
std::array< double, 5 > &  intersections 
)

Finds if vector "vec" has angular intersection w.

Parameters
part1
vec
cospatch
ti
intersections
Returns

patch of part1

◆ vec_perpproject()

Point Faunus::SpheroCylinder::vec_perpproject ( const Point a,
const Point b 
)
inline

Calculate perpendicular projection of the first vector versus the second vector.

Calculate projection of a vector to a plane define by second vector (normal of a plan)

Parameters
athe first vector
bthe second vector