From 8495a970270ff4fc04982ab2b510408f9a1b5cf3 Mon Sep 17 00:00:00 2001 From: pgovyadi Date: Thu, 4 Feb 2016 14:43:07 -0600 Subject: [PATCH] added comments to cylinder --- stim/visualization/cylinder.h | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/stim/visualization/cylinder.h b/stim/visualization/cylinder.h index 31524d2..49e3dec 100644 --- a/stim/visualization/cylinder.h +++ b/stim/visualization/cylinder.h @@ -11,22 +11,26 @@ template class cylinder { private: - stim::circle s; - std::vector< stim::vec > pos; - std::vector< stim::vec > mags; - std::vector< T > L; + stim::circle s; //an arbitrary circle + std::vector< stim::vec > pos; //positions of the cylinder. + std::vector< stim::vec > mags; //radii at each position + std::vector< T > L; //length of the cylinder at each position. + ///default init void init() { } + ///inits the cylinder from a list of points (inP) and radii (inM) void init(std::vector > inP, std::vector > inM) { pos = inP; mags = inM; + + //calculate each L. L.resize(pos.size()-1); T temp = (T)0; for(int i = 0; i < L.size()-1; i++) @@ -36,6 +40,7 @@ class cylinder } } + ///returns the direction vector at point idx. stim::vec d(int idx) { @@ -43,6 +48,7 @@ class cylinder } + ///returns the total length of the line at index j. T getl(int j) { @@ -53,6 +59,8 @@ class cylinder } } + ///finds the index of the point closest to the length l on the lower bound. + ///binary search. int findIdx(T l) { @@ -76,13 +84,13 @@ class cylinder } public: + ///default constructor cylinder() { } ///constructor to create a cylinder from a set of points, radii, and the number of sides for the cylinder. - ///The higher the number of sides, the more rectangeles compose the surface of the cylinder. ///@param inP: Vector of stim vecs composing the points of the centerline. ///@param inM: Vector of stim vecs composing the radii of the centerline. cylinder(std::vector > inP, std::vector > inM) @@ -92,6 +100,8 @@ class cylinder ///Returns a position vector at the given p-value (p value ranges from 0 to 1). + ///interpolates the position along the line. + ///@param pvalue: the location of the in the cylinder, from 0 (beginning to 1). stim::vec p(T pvalue) { @@ -102,6 +112,10 @@ class cylinder return (pos[idx] + (pos[idx+1]-pos[idx])*((l-L[idx])/(L[idx+1]- L[idx]))); } + ///Returns a position vector at the given length into the fiber (based on the pvalue). + ///Interpolates the radius along the line. + ///@param l: the location of the in the cylinder. + ///@param idx: integer location of the point closest to l but prior to it. stim::vec p(T l, int idx) { @@ -109,6 +123,8 @@ class cylinder } ///Returns a radius at the given p-value (p value ranges from 0 to 1). + ///interpolates the radius along the line. + ///@param pvalue: the location of the in the cylinder, from 0 (beginning to 1). T r(T pvalue) { @@ -119,6 +135,10 @@ class cylinder return (mags[idx] + (mags[idx+1]-mags[idx])*((l-L[idx])/(L[idx+1]- L[idx]))); } + ///Returns a radius at the given length into the fiber (based on the pvalue). + ///Interpolates the position along the line. + ///@param l: the location of the in the cylinder. + ///@param idx: integer location of the point closest to l but prior to it. T r(T l, int idx) { @@ -127,7 +147,9 @@ class cylinder ///returns the position of the point with a given pvalue and theta on the surface - ///in x, y, z coordinates. Theta is in degrees from 0 to 360 + ///in x, y, z coordinates. Theta is in degrees from 0 to 360. + ///@param pvalue: the location of the in the cylinder, from 0 (beginning to 1). + ///@param theta: the angle to the point of a circle. stim::vec surf(T pvalue, T theta) { @@ -142,6 +164,8 @@ class cylinder return(s.p(theta)); } + ///returns a vector of points necessary to create a circle at every position in the fiber. + ///@param sides: the number of sides of each circle. std::vector > > getPoints(int sides) { -- libgit2 0.21.4