Click here to Skip to main content
15,179,476 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionReduce a Q2SAT formula Pin
Apurvgupta15-Jun-14 21:48
MemberApurvgupta15-Jun-14 21:48 
QuestionFastest textual decompression in C Pin
Sanmayce10-May-14 9:54
MemberSanmayce10-May-14 9:54 
AnswerRe: Fastest textual decompression in C Pin
Richard MacCutchan10-May-14 22:46
mveRichard MacCutchan10-May-14 22:46 
GeneralRe: Fastest textual decompression in C Pin
Sanmayce12-May-14 1:18
MemberSanmayce12-May-14 1:18 
GeneralRe: Fastest textual decompression in C Pin
Richard MacCutchan12-May-14 2:24
mveRichard MacCutchan12-May-14 2:24 
GeneralRe: Fastest textual decompression in C Pin
Chris Losinger23-May-14 4:12
professionalChris Losinger23-May-14 4:12 
GeneralRe: Fastest textual decompression in C Pin
Sanmayce24-May-14 8:17
MemberSanmayce24-May-14 8:17 
QuestionThe Bessel-Overhauser Spline interpolation - suitable values for the weight function Pin
Kenneth Haugland4-Apr-14 0:34
mvaKenneth Haugland4-Apr-14 0: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 1:30
mvaKenneth Haugland6-Apr-14 1:30 
QuestionFactoring algorithm Pin
Member 41945931-Apr-14 5:46
MemberMember 41945931-Apr-14 5:46 
AnswerRe: Factoring algorithm Pin
Bernhard Hiller1-Apr-14 21:44
MemberBernhard Hiller1-Apr-14 21:44 
GeneralRe: Factoring algorithm Pin
Member 41945932-Apr-14 7:17
MemberMember 41945932-Apr-14 7:17 
GeneralRe: Factoring algorithm Pin
Kornfeld Eliyahu Peter2-Apr-14 10:30
professionalKornfeld Eliyahu Peter2-Apr-14 10:30 
AnswerRe: Factoring algorithm Pin
Peter_in_278023-May-14 16:34
professionalPeter_in_278023-May-14 16:34 
GeneralRe: Factoring algorithm Pin
Member 419459323-May-14 18:03
MemberMember 419459323-May-14 18:03 
QuestionTeam Contract Algorithm Pin
Laurence Senna27-Mar-14 21:23
MemberLaurence Senna27-Mar-14 21:23 
AnswerRe: Team Contract Algorithm Pin
Richard MacCutchan28-Mar-14 1:22
mveRichard MacCutchan28-Mar-14 1:22 
QuestionDetecting File Changes Pin
Richard Andrew x6427-Mar-14 14:44
professionalRichard Andrew x6427-Mar-14 14:44 
AnswerRe: Detecting File Changes Pin
Richard MacCutchan27-Mar-14 23:19
mveRichard MacCutchan27-Mar-14 23:19 
GeneralRe: Detecting File Changes Pin
Matt T Heffron28-Mar-14 8:22
professionalMatt T Heffron28-Mar-14 8:22 
GeneralRe: Detecting File Changes Pin
Richard MacCutchan28-Mar-14 9:04
mveRichard MacCutchan28-Mar-14 9:04 
QuestionHow much is my encryption algorithm worth? Pin
Daniel Mullarkey22-Mar-14 21:47
MemberDaniel Mullarkey22-Mar-14 21:47 
AnswerRe: How much is my encryption algorithm worth? Pin
Kornfeld Eliyahu Peter22-Mar-14 22:19
professionalKornfeld Eliyahu Peter22-Mar-14 22:19 
AnswerRe: How much is my encryption algorithm worth? Pin
Richard MacCutchan22-Mar-14 23:10
mveRichard MacCutchan22-Mar-14 23:10 
AnswerRe: How much is my encryption algorithm worth? Pin
Daniel Mullarkey23-Mar-14 4:34
MemberDaniel Mullarkey23-Mar-14 4: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.