All pastes #154488 Raw Edit

Anonymous

public text v1 · immutable
#154488 ·published 2006-08-30 11:14 UTC
rendered paste body
		if(dist != 0)
			/* this gives length = first copy start to last copy end
			   add a tiny offset for floating point rounding errors */
			count = (length + 0.00001) / dist;
		else
			/* if the offset has no translation, just make one copy */
			count = 1;
	}

	if(count < 1)
		count = 1;

	/* allocate memory for count duplicates (including original) */
	result = CDDM_from_template(dm, dm->getNumVerts(dm) * count,
	                            dm->getNumEdges(dm) * count,
	                            dm->getNumFaces(dm) * count);

	/* calculate the offset matrix of the final copy (for merging) */ 
	MTC_Mat4One(final_offset);

	for(j=0; j < count - 1; j++) {
		MTC_Mat4MulMat4(tmp_mat, final_offset, offset);
		MTC_Mat4CpyMat4(final_offset, tmp_mat);
	}