# How to transform or "smoothen" this "line"

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 22, 2007, 08:27 How to transform or "smoothen" this "line" #1 CH Guest   Posts: n/a Hi, I need some help to transform or "smoothen" a line.... Supposed I've got a straight line, at angle of 30deg to the horizontal. Hence it's gradient is tan(30). If I want to "smoothen" this line such that at one end of the line, its gradient is fixed at tan(30). However, at the other other I want its gradient to be 0. What factor or transformation can I use to get a smooth curve based on this 2 criteria. Note that only the gradient of one end of the line is changed to 0, the location of the end points are fixed. Thank you

 April 23, 2007, 16:48 Re: How to transform or "smoothen" this "line" #2 Mani Guest   Posts: n/a A popular way to construct such functions is to use polynomial splines. I personally like Hermite polynomials which are used in finite elements, but are very convenient for any kind of application like the one you describe. I'd have to look up the definition of the polynomials to show you the very easy way to construct a solution by superposition, but of course there is also a more tedious way that's easier to remember: Given both endpoints and both gradients you have 4 pieces of information to obtain the 4 coefficients of a third-order polynomial. You should remember from high-school or an undergrad math class how to do this by solving a system of 4 equations.

 April 24, 2007, 22:52 Re: How to transform or "smoothen" this "line" #3 CH Guest   Posts: n/a Thanks Mani. Ya guess the simplest way will be a 3rd degree polynomial. However the problem with this mtd is that the x value is unchanged since it's a 1-d modification. Hence, the perpendicular grid spacing will change. There are also no more DOF to play around with Moreover, I have a problem implementing the 3rd degree polynomial when I have one of the gradient at one corner to be a vertical line ie gradient = infinity. How can I get the correct coefficient? I thought of transforming the line by 90 deg so that the new gradient is 0, get the new y values, and then transforming it back. However it seems very troublesome. I wonder if there's a better mtd. Thanks

 April 25, 2007, 10:39 Re: How to transform or "smoothen" this "line" #4 Jonas Holdeman Guest   Posts: n/a If you want greater flexibility, consider parametric curves. That is, you introduce a parametric variable (call it t), and write the x- and y-coordinates of a point on the curve as x=X(t), y=Y(t) (and z=Z(t)), where the functions X(t)... are cubic functions of t (0<=t<=1). You choose the polynomial coefficients in these functions to match the slopes and endpoints. There are then parameters/coefficients left over to control the curve between the ends. Special cases are x=t with y=Y(t)=Y(x), the cubic polynomial in x, and y=t with x=X(t)=X(y), the cubic polynomial in y. Infinite slopes are no problem; you just choose the coefficients in such a way that dy/dt=0 at such a point. There are parameterizations of the coefficients to make things easier. An example is Bezier curves, but there are others.

 April 25, 2007, 10:50 Re: How to transform or "smoothen" this "line" #5 Jonas Holdeman Guest   Posts: n/a Oops, I said the business of infinite slopes wrong. To get an infinite slope at a point, you set dx/dt=0 there. Then as t changes, y changes but not x, giving an infinite slope.

 April 25, 2007, 11:24 Re: How to transform or "smoothen" this "line" #6 Mani Guest   Posts: n/a I think you need to describe your application (I gather it's grid generation) in more detail. Parametric curves might be the way to go, as Jonas suggests. It may also be as simple as working with the local curvilinear coordinates instead of "x and y".

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post nishant_hull Open Source Meshers: Gmsh, Netgen, CGNS, ... 23 August 5, 2015 02:09 flakid OpenFOAM Installation 16 December 28, 2010 09:48 hariya03 OpenFOAM Pre-Processing 0 April 18, 2008 04:26 Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00 CFD user CFX 3 November 25, 2002 16:16

All times are GMT -4. The time now is 20:30.