Hello ALL
2 Examples of asking Bing AI to write a Transformation Matrix to rotate a graph.
First it decided to work with only 1 point.
Second I asked it to work with 4 points
Its definitely not there yet.
I see copy/paste of snippets of some code it found in a search,
but no proper logic or understanding of how to combine the x,y,z matrices into one
As for C ... I recommend buying a C-Book and learning the language yourself
rather then depending on something else, where you don't know what its doing.
=================================
Example 1
=================================
Line 21 Error (R2) : Array Access (Index out of range)
in file C:/MyStuff/AA-Matrix/Bing-AI-Rotate-A-Point-1.ring
==> point[0], not starting index at 1
// You
// write a Ring language program to do create Transformation vector to rotate a 3D graph
// Copilot
// Certainly! Let’s create a simple Ring language program to perform a 3D rotation on a vector. In this example, I’ll demonstrate how to construct a rotation matrix to rotate a 3D point around one of the coordinate axes.
# Define a 3D point (x, y, z)
point = [1.0, 2.0, 3.0]
# Define the rotation angle in radians (e.g., 45 degrees)
theta = 45.0 * (3.14159 / 180.0) # Convert degrees to radians
# Create a rotation matrix for rotation around the X-axis
rotation_matrix_x = [
[1.0, 0.0, 0.0],
[0.0, cos(theta), -sin(theta)],
[0.0, sin(theta), cos(theta)]
]
# Apply the rotation
new_point_x = [
point[0],
point[1] * cos(theta) - point[2] * sin(theta),
point[1] * sin(theta) + point[2] * cos(theta)
]
# Print the original and rotated points
println("Original point: (${point[0]}, ${point[1]}, ${point[2]})")
println("Rotated point (around X-axis): (${new_point_x[0]}, ${new_point_x[1]}, ${new_point_x[2]})")
//In this program:
//point represents the original 3D point.
//theta is the rotation angle (in radians) around the X-axis.
//The rotation matrix rotation_matrix_x is constructed for rotation around the X-axis.
//The new point after rotation is calculated by multiplying the original point with the rotation matrix.
//Feel free to modify the rotation angle and axis to explore different transformations! 🌟
======================================
Example 2
======================================
Line 39 Error (R3) : Calling Function without definition: matrix_multiply
in file C:/MyStuff/AA-Matrix/Bing-AI-Rotate-4-Point-2.ring
===> combined_rotation_matrix = matrix_multiply(rotation_matrix_x, matrix_multiply(rotation_matrix_y, rotation_matrix_z))
Definitely Not the way to do this
//You
//write a Ring language program to do create Transformation vector to rotate a 4 x 4 graph in x, y, z direction of 10, 15,20 degrees
//Copilot
//Certainly! Let’s create a Ring language program to perform a 3D rotation on a 4x4 graph. We’ll apply rotations around the X, Y, and Z axes by the specified angles.
# Define the rotation angles in degrees
angle_x_deg = 10.0
angle_y_deg = 15.0
angle_z_deg = 20.0
# Convert angles to radians
angle_x_rad = angle_x_deg * (3.14159 / 180.0)
angle_y_rad = angle_y_deg * (3.14159 / 180.0)
angle_z_rad = angle_z_deg * (3.14159 / 180.0)
# Create rotation matrices for each axis
rotation_matrix_x = [
[1.0, 0.0, 0.0, 0.0],
[0.0, cos(angle_x_rad), -sin(angle_x_rad), 0.0],
[0.0, sin(angle_x_rad), cos(angle_x_rad), 0.0],
[0.0, 0.0, 0.0, 1.0]
]
rotation_matrix_y = [
[cos(angle_y_rad), 0.0, sin(angle_y_rad), 0.0],
[0.0, 1.0, 0.0, 0.0],
[-sin(angle_y_rad), 0.0, cos(angle_y_rad), 0.0],
[0.0, 0.0, 0.0, 1.0]
]
rotation_matrix_z = [
[cos(angle_z_rad), -sin(angle_z_rad), 0.0, 0.0],
[sin(angle_z_rad), cos(angle_z_rad), 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0]
]
# Combine the rotation matrices
combined_rotation_matrix = matrix_multiply(rotation_matrix_x, matrix_multiply(rotation_matrix_y, rotation_matrix_z))
# Print the resulting 4x4 rotation matrix
println("Combined Rotation Matrix:")
for row in combined_rotation_matrix {
println(row)
}
//In this program:
//
//We define the rotation angles around the X, Y, and Z axes.
//Each rotation matrix is constructed for its respective axis.
//The matrices are multiplied together to obtain the final combined rotation matrix.
//Feel free to adjust the angles or apply additional transformations as needed! 🌟
=============================
=============================