Click here to Skip to main content
15,881,715 members
Home / Discussions / Algorithms
   

Algorithms

 
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?
AnswerRe: The Bessel-Overhauser Spline interpolation - suitable values for the weight function Pin
Kenneth Haugland6-Apr-14 0:30
mvaKenneth Haugland6-Apr-14 0:30 
QuestionFactoring algorithm Pin
Member 41945931-Apr-14 4:46
Member 41945931-Apr-14 4:46 
AnswerRe: Factoring algorithm Pin
Bernhard Hiller1-Apr-14 20:44
Bernhard Hiller1-Apr-14 20:44 
GeneralRe: Factoring algorithm Pin
Member 41945932-Apr-14 6:17
Member 41945932-Apr-14 6:17 
GeneralRe: Factoring algorithm Pin
Kornfeld Eliyahu Peter2-Apr-14 9:30
professionalKornfeld Eliyahu Peter2-Apr-14 9:30 
AnswerRe: Factoring algorithm Pin
Peter_in_278023-May-14 15:34
professionalPeter_in_278023-May-14 15:34 
GeneralRe: Factoring algorithm Pin
Member 419459323-May-14 17:03
Member 419459323-May-14 17:03 
QuestionTeam Contract Algorithm Pin
Laurence Senna27-Mar-14 20:23
Laurence Senna27-Mar-14 20:23 
AnswerRe: Team Contract Algorithm Pin
Richard MacCutchan28-Mar-14 0:22
mveRichard MacCutchan28-Mar-14 0:22 
QuestionDetecting File Changes Pin
Richard Andrew x6427-Mar-14 13:44
professionalRichard Andrew x6427-Mar-14 13:44 
AnswerRe: Detecting File Changes Pin
Richard MacCutchan27-Mar-14 22:19
mveRichard MacCutchan27-Mar-14 22:19 
GeneralRe: Detecting File Changes Pin
Matt T Heffron28-Mar-14 7:22
professionalMatt T Heffron28-Mar-14 7:22 
GeneralRe: Detecting File Changes Pin
Richard MacCutchan28-Mar-14 8:04
mveRichard MacCutchan28-Mar-14 8:04 
QuestionHow much is my encryption algorithm worth? Pin
Daniel Mullarkey22-Mar-14 20:47
Daniel Mullarkey22-Mar-14 20:47 
AnswerRe: How much is my encryption algorithm worth? Pin
Kornfeld Eliyahu Peter22-Mar-14 21:19
professionalKornfeld Eliyahu Peter22-Mar-14 21:19 
AnswerRe: How much is my encryption algorithm worth? Pin
Richard MacCutchan22-Mar-14 22:10
mveRichard MacCutchan22-Mar-14 22:10 
AnswerRe: How much is my encryption algorithm worth? Pin
Daniel Mullarkey23-Mar-14 3:34
Daniel Mullarkey23-Mar-14 3:34 

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.