Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Newsgroups | sci.math |
| Subject | Re: JULIA Plots & the MANDELBROT Set ! |
| Date | 2021-01-30 18:03 -0800 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <rv534p$1ngo$1@gioia.aioe.org> (permalink) |
| References | <WU%QH.39958$xa.27089@fx47.iad> <eieRH.8203$Cg2.5736@fx37.iad> |
On 1/30/2021 6:45 AM, casagiannoni@optonline.net wrote:
> Here's what my program does: The domain of the calculations about the origin, is set by the Field H and Field V inputs. Calculations are done at 1920 points horizontally and 1080 points vertically, and the results are mapped to the corresponding 1920 x 1080 screen for optimal display. To expand and study a particular part of a Julia, it must be moved off center with the Center H and Center V, such that the part to be studied is centered at the origin, and then the Field H and Field V must be selected for the desired magnification.
>
>
Did you take a close look at my plotting code? It allows one to set the
width and height of the screen, yet maintains a proper aspect ratio, an
example in C++:
Read this, this happens to show my vector field plotted on a spiral fractal:
https://pastebin.com/raw/txz3pQ2Y
This function allows one to zoom in and out, and set the center point:
____________________________
struct ct_axes
{
double xmin;
double xmax;
double ymin;
double ymax;
};
struct ct_axes
ct_axes_from_point(
ct_complex z,
double radius
) {
struct ct_axes axes = {
z.real() - radius, z.real() + radius,
z.imag() - radius, z.imag() + radius
};
return axes;
}
____________________________
The following function gives the correct aspect ratio for the plane, no
matter what width and height you use:
________________
void
ct_plane_init(
struct ct_plane* const self,
struct ct_axes const* axes,
unsigned long width,
unsigned long height
) {
self->axes = *axes;
double awidth = self->axes.xmax - self->axes.xmin;
double aheight = self->axes.ymax - self->axes.ymin;
assert(width > 0 && height > 0 && awidth > 0.0);
double daspect = fabs((double)height / width);
double waspect = fabs(aheight / awidth);
if (daspect > waspect)
{
double excess = aheight * (daspect / waspect - 1.0);
self->axes.ymax += excess / 2.0;
self->axes.ymin -= excess / 2.0;
}
else if (daspect < waspect)
{
double excess = awidth * (waspect / daspect - 1.0);
self->axes.xmax += excess / 2.0;
self->axes.xmin -= excess / 2.0;
}
self->xstep = (self->axes.xmax - self->axes.xmin) / width;
self->ystep = (self->axes.ymax - self->axes.ymin) / height;
}
________________
You can port this to VB6. No matter what height and width you give it,
it still maintains a proper aspect ratio.
My plotting code in ShaderToy:
https://www.shadertoy.com/view/MdcyRs
________________
// Viewport Axes
struct ct_axes
{
float xmin;
float xmax;
float ymin;
float ymax;
};
ct_axes ct_axes_from_radius(
in vec3 vpcircle
){
return ct_axes(
vpcircle.x - vpcircle.z,
vpcircle.x + vpcircle.z,
vpcircle.y - vpcircle.z,
vpcircle.y + vpcircle.z
);
}
// Simple 2d Plane
struct ct_plane2d
{
ct_axes axes;
float xstep;
float ystep;
};
ct_plane2d ct_plane2d_create(
in ct_axes axes
){
float awidth = axes.xmax - axes.xmin;
float aheight = axes.ymax - axes.ymin;
float daspect = abs(iResolution.y / iResolution.x);
float waspect = abs(aheight / awidth);
if (daspect > waspect)
{
float excess = aheight * (daspect / waspect - 1.0);
axes.ymax += excess / 2.0;
axes.ymin -= excess / 2.0;
}
else if (daspect < waspect)
{
float excess = awidth * (waspect / daspect - 1.0);
axes.xmax += excess / 2.0;
axes.xmin -= excess / 2.0;
}
return ct_plane2d(
axes,
(axes.xmax - axes.xmin) / iResolution.x,
(axes.ymax - axes.ymin) / iResolution.y
);
}
vec2 ct_plane2d_project(
in ct_plane2d self,
in vec2 z
){
return vec2(
self.axes.xmin + z.x * self.xstep,
self.axes.ymin + z.y * self.ystep
);
}
________________
Can you read C++ and/or GLSL?
Back to sci.math | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-01-29 22:22 +0000
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-01-29 14:50 -0800
RE: Re: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-01-29 23:14 +0000
RE: Re: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-01-30 19:22 +0000
RE: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-01-30 14:45 +0000
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-01-30 18:03 -0800
RE: Re: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-01-31 14:17 +0000
Big PS - ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-02-03 18:51 +0000
RE: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-02-03 20:43 +0000
Re: JULIA Plots & the MANDELBROT Set ! FromTheRafters <erratic@nomail.afraid.org> - 2021-02-03 16:12 -0500
RE: Re: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-02-03 23:08 +0000
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-03 15:10 -0800
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-03 15:13 -0800
RE: Re: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-02-03 23:30 +0000
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-03 16:16 -0800
RE: Re: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-02-04 15:19 +0000
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-04 19:41 -0800
Re: JULIA Plots & the MANDELBROT Set ! FromTheRafters <erratic@nomail.afraid.org> - 2021-02-04 06:38 -0500
RE: Re: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-02-04 14:50 +0000
Re: JULIA Plots & the MANDELBROT Set ! FromTheRafters <erratic@nomail.afraid.org> - 2021-02-04 11:12 -0500
RE: Re: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-02-04 19:27 +0000
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-04 19:44 -0800
RE: Re: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-02-05 15:10 +0000
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-05 12:12 -0800
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-05 12:13 -0800
RE: Re: JULIA Plots & the MANDELBROT Set ! casagiannoni@optonline.net <casagiannoni@optonline.net> - 2021-02-05 20:38 +0000
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-05 13:03 -0800
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-06 15:49 -0800
Re: JULIA Plots & the MANDELBROT Set ! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-02-06 20:36 -0800
csiph-web