Bool operators on CYarnSectionInterpNode

General discussion about TexGen.

Moderators: Martin, Developers

Post Reply
vptudd
Posts: 4
Joined: Thu Feb 02, 2017 3:20 pm

Bool operators on CYarnSectionInterpNode

Post by vptudd »

Hi,
for the documentation of my script I need to know which function the three bool operators necessary to use the CYarnSectionInterpNode are needed for.
The function is described here: http://texgen.sourceforge.net/api/class ... _node.html
but I don´t really know what to do with this informations.
Any help is greatly appreciated.
Regards,
Valentin
louisepb
Project Leader
Posts: 998
Joined: Tue Dec 08, 2009 2:27 pm
Location: Nottingham

Re: Bool operators on CYarnSectionInterpNode

Post by louisepb »

Hi Valentin,

The first two parameters govern how the points are interpolated between the master nodes using the code below. The value u has a value between 0 and 1.

Code: Select all

XY CYarnSectionInterp::InterpolatePoints(XY P1, XY P2, double u) const
{
	if (m_bRamped)
		u = 3 * u * u - 2 * u * u * u;
	if (m_bPolar)
	{
		double l1, l2, l;
		double a1, a2, a;
		l1 = GetLength(P1);
		l2 = GetLength(P2);
		l = l1+(l2-l1)*u;
		a1 = atan2(P1.y, P1.x);
		a2 = atan2(P2.y, P2.x);
		if (abs(a1-a2) > PI)
		{
			if (a1 < a2)
				a1+=2*PI;
			else
				a2+=2*PI;
		}
		a = a1+(a2-a1)*u;
		XY P;
		P.x = l*cos(a);
		P.y = l*sin(a);
		return P;
	}
	else
		return P1+(P2-P1)*u;
}
The third parameter specifies whether the section meshes at each slave node along the yarn have the same configuration. The section meshes can be seen by using the Render->Volume Mesh option. If this value is false and the cross-section shape varies significantly along the length of the yarn then the number of rows and columns in the mesh may change which then means that it is not possible to generate the volume mesh.

As there are default values set for these variables then calling the function with no parameters will automatically use these values.

Hope that helps,
Louise
Post Reply