sub
gdraw {
my
(
$this
,
$points
) =
@_
;
glDisable(
&GL_LIGHTING
);
glColor3d(@{
$this
->{Options}{Color}});
PDL::Graphics::OpenGLQ::gl_arrows(
$points
,@{
$this
->{Options}}{
qw(From To
ArrowLen ArrowWidth)
});
glEnable(
&GL_LIGHTING
);
}
sub
get_valid_options {
return
{
UseDefcols
=> 0,
From
=> [],
To
=> [],
Color
=> [1,1,1],
ArrowWidth
=> 0.02,
ArrowLen
=> 0.1}
}
sub
new {
my
(
$type
,
$coords
) =
@_
;
bless
{
Coords
=>
$coords
,
BoxSize
=> 3,
DMult
=> 5000,
A
=> -100.0,
B
=> -5,
C
=> -0.1,
D
=> 0.01,
M
=> 30,
MS
=> 1,
},
$type
;
}
sub
set_links {
my
$this
=
shift
;
@$this
{
qw(From To Strength)
} =
@_
; }
sub
set_fixed {
my
$this
=
shift
;
@$this
{
qw(FInd FCoord)
} =
@_
; }
sub
step {
my
(
$this
) =
@_
;
my
$c
=
$this
->{Coords};
my
$velr
= repulse(
$c
,
@$this
{
qw(BoxSize DMult A B C D)
});
my
$vela
= attract(
$c
,
@$this
{
qw(From To Strength M MS)
});
my
$tst
= 0.10;
$this
->{Velo} = (
$this
->{Velo}//0) +
$tst
* 0.02 * (
$velr
+
$vela
);
$this
->{Velo} *=
(0.92*50/(50+
$this
->{Velo}->magnover->dummy(0)))*
*$tst
;
$c
+=
$tst
* 0.05 *
$this
->{Velo};
$c
->transpose->
index
(
$this
->{FInd}->dummy(0)) .=
$this
->{FCoord}
if
(
defined
$this
->{FInd});
print
"C: $c\n"
if
$PDL::Graphics::TriD::verbose
;
}
sub
getcoords {
$_
[0]{Coords}}
1;