Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
WIKI Timeout issues
Please read here if you have trouble connecting to the wiki
Recent
Trouble compiling fpc for...
by
ccrause
[
Today
at 04:10:41 pm]
Persistent MacOS Arm M ch...
by
Thaddy
[
Today
at 03:53:25 pm]
Feature request: hard typ...
by
Martin_fr
[
Today
at 03:33:32 pm]
Converting excel to csv -...
by
paweld
[
Today
at 02:21:32 pm]
MDI ChildForm
by
Dzandaa
[
Today
at 01:40:35 pm]
Pappas Chain Ring: Not Ro...
by
Boleeman
[
Today
at 01:06:20 pm]
control '' has no parent
by
dbannon
[
Today
at 01:00:56 pm]
Creating .deb packages fo...
by
CM630
[
Today
at 12:36:36 pm]
controls.lpr(731,15) Erro...
by
tetrastes
[
Today
at 12:04:54 pm]
Lazarus IDE crashes ( Due...
by
Martin_fr
[
Today
at 11:38:05 am]
Hint windows misplaced an...
by
DimTim
[
Today
at 11:08:12 am]
Compiler don't know the S...
by
Khrys
[
Today
at 08:11:30 am]
activex.pp definition pro...
by
Thaddy
[
Today
at 08:04:36 am]
My DIY dynamic array occu...
by
Thaddy
[
Today
at 06:06:50 am]
Forte Report CE Questions
by
PascalProg
[
Today
at 01:32:42 am]
Canvas.PolyBezier
by
wp
[
Today
at 12:16:24 am]
InstallAware 2025 Sources...
by
msintle
[July 07, 2025, 11:49:05 pm]
[SOLVED] Lazarus IDE 4 UI...
by
Psacla_63
[July 07, 2025, 11:03:06 pm]
Conant Fractal (Close to ...
by
Boleeman
[July 07, 2025, 10:38:58 pm]
problem with certain char...
by
tetrastes
[July 07, 2025, 09:22:02 pm]
Fast Canvas Library V1.05...
by
Lulu
[July 07, 2025, 07:58:57 pm]
Library for drawing a pat...
by
gidesa
[July 07, 2025, 07:43:59 pm]
Sutcliffe Fractal: Anothe...
by
Joanna
[July 07, 2025, 02:16:29 pm]
Billowing Flower: A Tenta...
by
Joanna
[July 07, 2025, 02:13:22 pm]
Spiral Mandala Patterns o...
by
Boleeman
[July 07, 2025, 01:56:56 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Peter de Jong Attractor: Bgrabmp Colouring Help Needed ? (Read 534 times)
Boleeman
Hero Member
Posts: 929
Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
«
on:
April 16, 2025, 10:19:59 am »
I made a Lazarus program that creates Peter de Jong Attractors.
I am trying to get a
smooth high coloured rainbow effect
like at
https://richardrosenman.com/shop/peter-de-jong-attractor/
I used a TBgrabmap for the rendering but have been struggling to get a high coloured rendering."
Up to version 4, after making a basic rendering and then extending it.
Logged
Thaddy
Hero Member
Posts: 17368
Ceterum censeo Trump esse delendam
Re: Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
«
Reply #1 on:
April 16, 2025, 02:14:43 pm »
Wow. Made me think to apply it to audio:
Code: Pascal
[Select]
[+]
[-]
unit
PeterDeJongAttractor
;
{$mode objfpc}
interface
uses
Math
,
Types
;
type
TDoublePoint
=
record
X
,
Y
:
Double
;
constructor
Create
(
AX
,
AY
:
Double
)
;
end
;
constructor
TDoublePoint
.
Create
(
AX
,
AY
:
Double
)
;
begin
X
:
=
AX
;
Y
:
=
AY
;
end
;
TPDJAttractor
=
class
private
Fx
,
Fy
:
Double
;
FParamA
,
FParamB
,
FParamC
,
FParamD
:
Double
;
public
constructor
Create
(
a
,
b
,
c
,
d
:
Double
)
;
/// Returns the next point in the attractor sequence
function
Iterate
:
TDoublePoint
;
inline
;
/// Reset to initial state (optional)
procedure
Reset
;
inline
;
end
;
implementation
constructor
TPDJAttractor
.
Create
(
a
,
b
,
c
,
d
:
Double
)
;
begin
FParamA
:
=
a
;
FParamB
:
=
b
;
FParamC
:
=
c
;
FParamD
:
=
d
;
Fx
:
=
0
;
Fy
:
=
0
;
end
;
function
TPDJAttractor
.
Iterate
:
TDoublePoint
;
var
newX
,
newY
:
Double
;
begin
newX
:
=
Sin
(
FParamA
*
Fy
)
-
Cos
(
FParamB
*
Fx
)
;
newY
:
=
Sin
(
FParamC
*
Fx
)
-
Cos
(
FParamD
*
Fy
)
;
Fx
:
=
newX
;
Fy
:
=
newY
;
Result
:
=
TDoublePoint
.
Create
(
newX
,
newY
)
;
end
;
procedure
TPDJAttractor
.
Reset
;
begin
Fx
:
=
0
;
Fy
:
=
0
;
end
;
end
.
Then:
Code: Pascal
[Select]
[+]
[-]
procedure
TMyVSTModule
.
ProcessAudioBlock
(
Buffer
:
PSingle
;
SampleCount
:
Integer
)
;
var
i
:
Integer
;
AttractorPoint
:
TDoublePoint
;
ModulationValue
:
Single
;
begin
for
i
:
=
0
to
SampleCount
-
1
do
begin
// Retrieve the current attractor values (could be at a slower modulation rate)
AttractorPoint
:
=
FMyAttractor
.
Iterate
;
// Map the output to a useful modulation range. For example, normalize and scale:
ModulationValue
:
=
(
CSng
(
AttractorPoint
.
X
)
+
2
)
/
4
;
// maps from [-2,2] to [0,1]
// Use ModulationValue to influence a parameter in your DSP code:
// For example, adjust oscillator frequency, filter cutoff, etc.
ApplyModulationToYourDSP
(
ModulationValue
)
;
// Continue processing audio...
Buffer
[
i
]
:
=
ProcessSample
(
Buffer
[
i
]
)
;
end
;
end
;
I think I have a VST to write....This is just a scetch.
You can probably also use this simple unit for your graphics purpose.
«
Last Edit: April 16, 2025, 02:55:37 pm by Thaddy
»
Logged
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.
Boleeman
Hero Member
Posts: 929
Re: Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
«
Reply #2 on:
April 17, 2025, 01:44:08 am »
Wondered how that audio version would sound ?
There are lots of graphic versions about , written in other languages but never thought of audio versions.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
Peter de Jong Attractor: Bgrabmp Colouring Help Needed ?
TinyPortal
© 2005-2018