Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

ITS FRIDAY FRIDAY, GOT TO GET DOWN ON FRIDAY

Me, not much, I have made plans for games, Plans, I have tracked down hackerfoo.com and just got a rejection from Chucklefish Ltd on Rust language for game consoles. Looks like hackerF00 might have a PlayStation 5 thing. Off to request from Rust foundation their official papers on it (they had some). That page I linked to is recent. These people are amazing. X E.
 
Python:
import numpy as np
import plotly.graph_objects as go

# Define spatial dimensions
x = np.linspace(-10, 10, 20)
y = np.linspace(-10, 10, 20)
z = np.linspace(-10, 10, 20)
X, Y, Z = np.meshgrid(x, y, z)

# Define wave parameters
kx = 1      # Wave number in x-direction
ky = 1      # Wave number in y-direction
kz = 1      # Wave number in z-direction
omega = 1   # Angular frequency

# Number of frames for animation
n_frames = 50
time_values = np.linspace(0, 10, n_frames)  # Time values for each frame

# Create the figure
fig = go.Figure()

# Add the initial isosurface trace (for t=0)
fig.add_trace(go.Isosurface(
    x=X.flatten(),
    y=Y.flatten(),
    z=Z.flatten(),
    value=np.sin(kx * X + ky * Y + kz * Z - omega * 0).flatten(),  # Initial state
    isomin=-1,
    isomax=1,
    surface_count=5,
    colorscale='plasma',
    opacity=0.6,
    colorbar=dict(title="Wave Amplitude")
))

# Create frames for the animation
frames = []
for t in time_values:
    Z_wave = np.sin(kx * X + ky * Y + kz * Z - omega * t)
    print(f"Calculating and creating frame for time t = {t}")  # Print statement added
    frame = go.Frame(
        data=[go.Isosurface(
            x=X.flatten(),
            y=Y.flatten(),
            z=Z.flatten(),
            value=Z_wave.flatten(),
            isomin=-1,
            isomax=1,
            surface_count=5,
            colorscale='plasma',
            opacity=0.6
        )],
        name=f"frame_{t}",
        layout=dict(annotations=[dict(
            text=f"Time = {t:.2f}",  # Display time in annotation
            x=0.1,
            y=0.9,
            xref="paper",
            yref="paper",
            showarrow=False,
            font=dict(size=14, color="white")
        )])
    )
    frames.append(frame)

# Add frames to the figure
fig.frames = frames

# Add animation controls, main title, and the TIME SLIDER
fig.update_layout(
    title='3D Wavefront Propagation in Space and Time',  # Main title
    annotations=[  # Main title annotation (moved here)
        dict(
            text="3D Wave Propagation Over Time",
            x=0.5,
            y=1.1,             
            xref="paper",  # Now correctly scoped
            yref="paper",  # Now correctly scoped
            showarrow=False,
            font=dict(size=14, color="black")
        )
    ],
    scene=dict(  # Scene layout only for axis titles
        xaxis_title='X',
        yaxis_title='Y',
        zaxis_title='Z',
    ),
     sliders=[dict(
        active=0,  # Start at the first frame
        currentvalue={"prefix": "Time: "},  # Label before the time value
        pad={"t": 50},  # Add some padding at the top                   
        steps=[dict(
            label=f"{t:.2f}",  # Label for each step (time value)
            method="animate",
            args=[[f"frame_{t}"],  # Animate to the corresponding frame
                  {"frame": {"duration": 0, "redraw": True}, "mode": "immediate"}] #Go to frame without animation
        ) for t in time_values]
    )],
    updatemenus=[dict(
        type="buttons",
        buttons=[dict(label="Play",
                      method="animate",
                      args=[None, {"frame": {"duration": 100, "redraw": True}, "fromcurrent": True}])]
    )]
)

# Add subtitle/description (this is fine where it is)
fig.add_annotation(
    text="This visualization shows a 3D wave propagating through space over time. The wave's amplitude is represented by color, and its shape evolves as time progresses.",
    x=0.5,
    y=-0.1,
    xref="paper",
    yref="paper",
    showarrow=False,
    font=dict(size=12, color="gray")
)

fig.show()

What This Visualization Represents:

This animation shows a 3D wave propagating through space over time. Imagine a wave, like a ripple on the surface of water, but extended into three dimensions. The wave's shape and amplitude change as time progresses, creating a dynamic, evolving pattern.

  • 3D Space:
    • The wave exists in a three-dimensional space, represented by the XX, YY, and ZZ axes.
    • The isosurfaces show regions of constant wave amplitude, similar to contour lines on a map but extended into three dimensions.
  • Time:
    • Time is the fourth dimension, represented by the animation. Each frame corresponds to a specific moment in time.
    • As time progresses, the wavefront moves and changes shape, creating a mesmerizing 3D pattern.
 
Me, not much, I have made plans for games, Plans, I have tracked down hackerfoo.com and just got a rejection from Chucklefish Ltd on Rust language for game consoles. Looks like hackerF00 might have a PlayStation 5 thing. Off to request from Rust foundation their official papers on it (they had some). That page I linked to is recent. These people are amazing. X E.
Good luck, and keep us posted on your progress!
 
Python:
import numpy as np
import plotly.graph_objects as go

# Define spatial dimensions
x = np.linspace(-10, 10, 20)
y = np.linspace(-10, 10, 20)
z = np.linspace(-10, 10, 20)
X, Y, Z = np.meshgrid(x, y, z)

# Define wave parameters
kx = 1      # Wave number in x-direction
ky = 1      # Wave number in y-direction
kz = 1      # Wave number in z-direction
omega = 1   # Angular frequency

# Number of frames for animation
n_frames = 50
time_values = np.linspace(0, 10, n_frames)  # Time values for each frame

# Create the figure
fig = go.Figure()

# Add the initial isosurface trace (for t=0)
fig.add_trace(go.Isosurface(
    x=X.flatten(),
    y=Y.flatten(),
    z=Z.flatten(),
    value=np.sin(kx * X + ky * Y + kz * Z - omega * 0).flatten(),  # Initial state
    isomin=-1,
    isomax=1,
    surface_count=5,
    colorscale='plasma',
    opacity=0.6,
    colorbar=dict(title="Wave Amplitude")
))

# Create frames for the animation
frames = []
for t in time_values:
    Z_wave = np.sin(kx * X + ky * Y + kz * Z - omega * t)
    print(f"Calculating and creating frame for time t = {t}")  # Print statement added
    frame = go.Frame(
        data=[go.Isosurface(
            x=X.flatten(),
            y=Y.flatten(),
            z=Z.flatten(),
            value=Z_wave.flatten(),
            isomin=-1,
            isomax=1,
            surface_count=5,
            colorscale='plasma',
            opacity=0.6
        )],
        name=f"frame_{t}",
        layout=dict(annotations=[dict(
            text=f"Time = {t:.2f}",  # Display time in annotation
            x=0.1,
            y=0.9,
            xref="paper",
            yref="paper",
            showarrow=False,
            font=dict(size=14, color="white")
        )])
    )
    frames.append(frame)

# Add frames to the figure
fig.frames = frames

# Add animation controls, main title, and the TIME SLIDER
fig.update_layout(
    title='3D Wavefront Propagation in Space and Time',  # Main title
    annotations=[  # Main title annotation (moved here)
        dict(
            text="3D Wave Propagation Over Time",
            x=0.5,
            y=1.1,            
            xref="paper",  # Now correctly scoped
            yref="paper",  # Now correctly scoped
            showarrow=False,
            font=dict(size=14, color="black")
        )
    ],
    scene=dict(  # Scene layout only for axis titles
        xaxis_title='X',
        yaxis_title='Y',
        zaxis_title='Z',
    ),
     sliders=[dict(
        active=0,  # Start at the first frame
        currentvalue={"prefix": "Time: "},  # Label before the time value
        pad={"t": 50},  # Add some padding at the top                  
        steps=[dict(
            label=f"{t:.2f}",  # Label for each step (time value)
            method="animate",
            args=[[f"frame_{t}"],  # Animate to the corresponding frame
                  {"frame": {"duration": 0, "redraw": True}, "mode": "immediate"}] #Go to frame without animation
        ) for t in time_values]
    )],
    updatemenus=[dict(
        type="buttons",
        buttons=[dict(label="Play",
                      method="animate",
                      args=[None, {"frame": {"duration": 100, "redraw": True}, "fromcurrent": True}])]
    )]
)

# Add subtitle/description (this is fine where it is)
fig.add_annotation(
    text="This visualization shows a 3D wave propagating through space over time. The wave's amplitude is represented by color, and its shape evolves as time progresses.",
    x=0.5,
    y=-0.1,
    xref="paper",
    yref="paper",
    showarrow=False,
    font=dict(size=12, color="gray")
)

fig.show()

What This Visualization Represents:

This animation shows a 3D wave propagating through space over time. Imagine a wave, like a ripple on the surface of water, but extended into three dimensions. The wave's shape and amplitude change as time progresses, creating a dynamic, evolving pattern.

  • 3D Space:
    • The wave exists in a three-dimensional space, represented by the XX, YY, and ZZ axes.
    • The isosurfaces show regions of constant wave amplitude, similar to contour lines on a map but extended into three dimensions.
  • Time:
    • Time is the fourth dimension, represented by the animation. Each frame corresponds to a specific moment in time.
    • As time progresses, the wavefront moves and changes shape, creating a mesmerizing 3D pattern.
Sorry, I couldn't think of anything better for Friday, even though it took until Saturday 🙂
 
and this is now a wave in a 3-dimensional time, animated along a selectable time axis (in the code) while tho other time axis represent pseudo spatial dimensions :smiling_imp:😱 ?
Python:
import numpy as np
import plotly.graph_objects as go

# Define time dimensions
t_x = np.linspace(-10, 10, 30)
t_y = np.linspace(-10, 10, 30)
t_z = np.linspace(-10, 10, 30)
T_x, T_y, T_z = np.mgrid[-10:10:30j, -10:10:30j, -10:10:30j]  # Use mgrid for structured grid

# Define wave parameters
omega_x = 1  # Angular frequency in T_x direction
omega_y = 1  # Angular frequency in T_y direction
omega_z = 1  # Angular frequency in T_z direction

# Choose which axis to animate: "x", "y", or "z"
animated_axis = "y"  # Change this to "x", "y", or "z"

# Select the correct time array based on user choice
if animated_axis == "x":
    time_values = t_x
    wave_function = lambda tx: np.sin(omega_x * tx + omega_y * T_y + omega_z * T_z)
elif animated_axis == "y":
    time_values = t_y
    wave_function = lambda ty: np.sin(omega_x * T_x + omega_y * ty + omega_z * T_z)
else:  # Default to "z"
    time_values = t_z
    wave_function = lambda tz: np.sin(omega_x * T_x + omega_y * T_y + omega_z * tz)

# Create the figure
fig = go.Figure()

# Compute initial wave state (at first time value)
initial_wave = wave_function(time_values[0])

fig.add_trace(go.Isosurface(
    x=T_x.flatten(),
    y=T_y.flatten(),
    z=T_z.flatten(),
    value=initial_wave.flatten(),
    isomin=-1,
    isomax=1,
    surface_count=5,
    colorscale='plasma',
    opacity=0.6,
    colorbar=dict(title="Wave Amplitude")
))

# Create frames for animation
frames = []
for t_val in time_values:
    wave_3d_time = wave_function(t_val)
    frame = go.Frame(
        data=[go.Isosurface(
            x=T_x.flatten(),
            y=T_y.flatten(),
            z=T_z.flatten(),
            value=wave_3d_time.flatten(),
            isomin=-1,
            isomax=1,
            surface_count=5,
            colorscale='plasma',
            opacity=0.6
        )],
        name=f"frame_{t_val:.2f}"
    )
    frames.append(frame)

# Add frames to the figure
fig.frames = frames

# Add animation controls
fig.update_layout(
    title=f"Wave in 3D Time (Animated along {animated_axis.upper()})",
    scene=dict(
        xaxis_title="T_x (Time Dimension 1)",
        yaxis_title="T_y (Time Dimension 2)",
        zaxis_title="T_z (Time Dimension 3)",
    ),
    updatemenus=[dict(                
        type="buttons",
        buttons=[
            dict(
                label="Play",
                method="animate",
                args=[None, {"frame": {"duration": 100, "redraw": True}, "fromcurrent": True}]
            )
        ]
    )],
    sliders=[
        dict(
            steps=[
                dict(
                    method="animate",
                    args=[[f"frame_{t_val:.2f}"], {"frame": {"duration": 100, "redraw": True}, "mode": "immediate"}],
                    label=f"{t_val:.2f}"
                ) for t_val in time_values
            ]
        )
    ]
)

# Show the figure
fig.show()
 
Good luck, and keep us posted on your progress!
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
View: https://x.com/rustlang/status/988474536860553218
,
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
View: https://x.com/Kane_rogers/status/1596315487113072640
,
My sources, apparently that Rust paper from Chucklefish still exists and is with prev.rust-lang.org but it is almost certainly under NDAs, still unsure, not sharing until I know whether I can share legally. I have not looked at it for reason I am not under needed NDAs. From what I know, that Chucklefish Ltd thing used a lot of C and SDL2 for ALL game consoles and Rust and almost certainly had a compile target. X E.
 
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
View: https://x.com/rustlang/status/988474536860553218
,
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
View: https://x.com/Kane_rogers/status/1596315487113072640
,
My sources, apparently that Rust paper from Chucklefish still exists and is with prev.rust-lang.org but it is almost certainly under NDAs, still unsure, not sharing until I know whether I can share legally. I have not looked at it for reason I am not under needed NDAs. From what I know, that Chucklefish Ltd thing used a lot of C and SDL2 for ALL game consoles and Rust and almost certainly had a compile target. X E.
I looked at that PDF, no NDA needed but it basically has nothing anyway and original developer does not want to be contacted but I can use Defold. X E.
 
Back
Top Bottom