THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/03/2010 at 08:33, xxxxxxxx wrote:
Cinema 4D Version:
I have a plugin which generates a spline. What I want to do is implement a 'rounding' effect on the spline like that seen in the Rectangle spline primitive. Like the Rectangle, my spline starts out as Linear and would need to be a Hermite to implement this.
I've searched extensively here and on the net and can't find out how to do make this work. That is, I can do it manually in the code by setting the point tangents to estimated values, but what I'm looking for is an algorithm to calculate what the position and tangent length of the new points should be. I've studied the circle.cpp example and I get how that works but not how to implement it for anything other than a circle. Of course, this has to be done in GetContour() so I can't use SendModelingCommand() to do it - it looks as if I have to calculate the vectors myself.
Does anyone have any information on this or pointers to where I might find some?
On 17/03/2010 at 09:38, xxxxxxxx wrote:
Anyone have any thoughts about this? I'm pretty much hung up on getting this working. I'd be grateful for any help.
On 17/03/2010 at 11:26, xxxxxxxx wrote:
as i am working on something of this kind , so will give you some hints.
check SplineObject and SplineHelp in library.
tangent might be the answer.
On 17/03/2010 at 12:12, xxxxxxxx wrote:
I will try to answer tomorrow, was pretty busy with some other things today. Basically you need some understanding of the math behind it (trigonometry, Bezier curves).
On 17/03/2010 at 12:20, xxxxxxxx wrote:
Many thanks for the reply. I've previously looked through these classes in detail, but unfortunately they aren't helping me too much. I'm sure the answer is in there; I suspect the main problem is that I'm not entirely sure what all the functions do - or, more to the point, in what circumstances they are used.
I'm very grateful for your reply though - I'll look again at these areas, see what I can make of them.
On 17/03/2010 at 12:25, xxxxxxxx wrote:
Thank you very much! I can probably cope with the trig but Bezier curves are outside my experience at the moment, so I'd really like to hear anything you have on this. If you can point me in the right direction, that would be a great start.
At the moment I'm just trying to get a flat chamfer on the points; if I can get that to work, hopefully I can figure out the rounding using Beziers. I can get an accurate chamfer when the angle a point makes is a right angle, but when it's not - that's when I start to have problems. The angle of the chamfer just isn't correct.
On 18/03/2010 at 06:36, xxxxxxxx wrote:
EDIT: wrong information
On 18/03/2010 at 06:56, xxxxxxxx wrote:
That is exactly what I wanted to know! I'd got as far as a diagram identical to yours, but it was the formula for determining the tangent length that got me.
Thank you very much for taking the time to explain this, it's really appreciated.
On 19/03/2010 at 02:49, xxxxxxxx wrote:
Sorry, I made a mistake. Reading up on Bezier curves shows that the matter is more complicated. It involves so called "magic numbers".
Please check following links:
Approximation of a cubic Bezier curveand vice versa
cubic spline & Bezier curves library
On 19/03/2010 at 04:33, xxxxxxxx wrote:
Wow, some interesting maths in those references! I'll take a good look at them, many thanks.