Click here to Skip to main content
15,922,419 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Lock free algorithms Pin
SledgeHammer016-Sep-14 8:58
SledgeHammer016-Sep-14 8:58 
GeneralRe: Lock free algorithms Pin
Joe Woodbury6-Sep-14 9:50
professionalJoe Woodbury6-Sep-14 9:50 
GeneralRe: Lock free algorithms Pin
SledgeHammer016-Sep-14 11:35
SledgeHammer016-Sep-14 11:35 
GeneralRe: Lock free algorithms Pin
Joe Woodbury6-Sep-14 11:49
professionalJoe Woodbury6-Sep-14 11:49 
GeneralRe: Lock free algorithms Pin
SledgeHammer016-Sep-14 12:55
SledgeHammer016-Sep-14 12:55 
GeneralRe: Lock free algorithms Pin
Joe Woodbury6-Sep-14 13:11
professionalJoe Woodbury6-Sep-14 13:11 
GeneralRe: Lock free algorithms Pin
SledgeHammer016-Sep-14 13:37
SledgeHammer016-Sep-14 13:37 
GeneralRe: Lock free algorithms Pin
Joe Woodbury6-Sep-14 13:44
professionalJoe Woodbury6-Sep-14 13:44 
QuestionAlgorithm for comparing word with randomly distributed substring Pin
asdf2321130-Jun-14 23:06
asdf2321130-Jun-14 23:06 
AnswerRe: Algorithm for comparing word with randomly distributed substring Pin
Sanmayce3-Jul-14 7:15
Sanmayce3-Jul-14 7:15 
AnswerRe: Algorithm for comparing word with randomly distributed substring Pin
Sanmayce5-Jul-14 7:19
Sanmayce5-Jul-14 7:19 
QuestionCubesort Pin
Igor van den Hoven22-Jun-14 4:09
Igor van den Hoven22-Jun-14 4:09 
AnswerRe: Cubesort Pin
Sanmayce28-Jun-14 8:02
Sanmayce28-Jun-14 8:02 
GeneralRe: Cubesort Pin
Igor van den Hoven29-Jun-14 9:58
Igor van den Hoven29-Jun-14 9:58 
AnswerRe: Cubesort Pin
Sanmayce30-Jun-14 6:48
Sanmayce30-Jun-14 6:48 
GeneralRe: Cubesort Pin
Igor van den Hoven12-Jul-14 4:01
Igor van den Hoven12-Jul-14 4:01 
AnswerRe: Cubesort Pin
Sanmayce3-Jul-14 4:30
Sanmayce3-Jul-14 4:30 
QuestionReduce a Q2SAT formula Pin
Apurvgupta15-Jun-14 20:48
Apurvgupta15-Jun-14 20:48 
QuestionFastest textual decompression in C Pin
Sanmayce10-May-14 8:54
Sanmayce10-May-14 8:54 
AnswerRe: Fastest textual decompression in C Pin
Richard MacCutchan10-May-14 21:46
mveRichard MacCutchan10-May-14 21:46 
GeneralRe: Fastest textual decompression in C Pin
Sanmayce12-May-14 0:18
Sanmayce12-May-14 0:18 
GeneralRe: Fastest textual decompression in C Pin
Richard MacCutchan12-May-14 1:24
mveRichard MacCutchan12-May-14 1:24 
GeneralRe: Fastest textual decompression in C Pin
Chris Losinger23-May-14 3:12
professionalChris Losinger23-May-14 3:12 
GeneralRe: Fastest textual decompression in C Pin
Sanmayce24-May-14 7:17
Sanmayce24-May-14 7:17 
QuestionThe Bessel-Overhauser Spline interpolation - suitable values for the weight function Pin
Kenneth Haugland3-Apr-14 23:34
mvaKenneth Haugland3-Apr-14 23:34 
The formula that I'm using to create this is from the book "Mathematical tools in computer graphics with C# implementation", however it only had the formula and no code. You could find the same kind of formulations available online here[^], and skipback and forwards on the slides to see a bit more.

My Implementation looks like this:
VB
''' <summary>
''' The Bessel-Overhauser Spline interpolation
''' </summary>
''' <param name="p0">First point</param>
''' <param name="p1">Second point</param>
''' <param name="p2">Third point</param>
''' <param name="p3">Forth point</param>
''' <param name="t"></param>
''' <param name="u">The value from 0 - 1 where 0 is the start of the curve (globally) and 1 is the end of the curve (globally)</param>
''' <returns></returns>
''' <remarks></remarks>
Public Function PointOnBesselOverhauserCurve(ByVal p0 As System.Windows.Point, ByVal p1 As System.Windows.Point, ByVal p2 As System.Windows.Point, ByVal p3 As System.Windows.Point, ByVal t() As Double, ByVal u As Double) As System.Windows.Point
    Dim result As New System.Windows.Point()

    Dim ViXPlusHalf, VixMinusHalf, ViYPlusHalf, ViYMinusHalf, ViX, ViY As Double
    ViXPlusHalf = (p2.X - p1.X) / (t(2) - t(1))
    VixMinusHalf = (p1.X - p0.X) / (t(1) - t(0))
    ViYPlusHalf = (p2.Y - p1.Y) / (t(2) - t(1))
    ViYMinusHalf = (p1.Y - p0.Y) / (t(1) - t(0))

    ViX = ((t(2) - t(1)) * VixMinusHalf + (t(1) - t(0)) * ViXPlusHalf) / (t(2) - t(0))
    ViY = ((t(2) - t(1)) * ViYMinusHalf + (t(1) - t(0)) * ViYPlusHalf) / (t(2) - t(0))


    ' Location of Controlpoints
    Dim PointList As New PointCollection
    PointList.Add(p1)
    PointList.Add(New Point(p1.X + (1 / 3) * (t(2) - t(1)) * ViX, p1.Y + (1 / 3) * (t(2) - t(1)) * ViY))

    ViXPlusHalf = (p3.X - p2.X) / (t(3) - t(2))
    VixMinusHalf = (p2.X - p1.X) / (t(2) - t(1))
    ViYPlusHalf = (p3.Y - p2.Y) / (t(3) - t(2))
    ViYMinusHalf = (p2.Y - p1.Y) / (t(2) - t(1))

    ViX = ((t(3) - t(2)) * VixMinusHalf + (t(2) - t(1)) * ViXPlusHalf) / (t(3) - t(1))
    ViY = ((t(3) - t(2)) * ViYMinusHalf + (t(2) - t(1)) * ViYPlusHalf) / (t(3) - t(1))

    PointList.Add(New Point(p2.X - (1 / 3) * (t(3) - t(2)) * ViX, p2.Y - (1 / 3) * (t(3) - t(2)) * ViY))
    PointList.Add(p2)

    ' Get the calcualted value from the 3rd degree Bezier curve
    Return PointBezierFunction(PointList, u)
End Function


I assumed that t(), and array of equal length to the number of points, would be the same in both X and Y directions. Now, how should adjust my t() values, and should they be dependent on the values X and Y, meaning that they have one value for X and one value for Y? And, is the implementation correct?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.