Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
I can't get a cycloid's platted points to scale in a uniform way

How do I get the points to scale without distortion?
This section of my code takes a bunch of input parameters and creates a parametric function that plots points that are part of the line for a cycloid. The if statement, if (eclen), is a boolean that, when true, is supposed to scale the points by adding (ec_shell-cymod) to the (x,y) points radially from the (0,0). The first picture is the cycloid unscaled. Post scale, the cycloid needs to sit right against the outer circles.
The following image shows the cycloid after I scaled it; it scaled correctly in the x-direction, but not in the y-direction. The distortion is obvious. why is it distorting
i also gave my logs for the calculated (x,y) and the additons to x and y and the final resulting x and y, thetas, and trig values
——————————————————————————————————————-
FeatureScript 2656;
import(path : "onshape/std/common.fs", version : "2
656.0");
export const plotCycloid = function(context is Context, id is Id, definition is map)
{
// function plotCycloid (context is Context, id is Id, definition is map)
var D = definition.D; var d_r = definition.d_r; var N = definition.N; var ec_shell = definition.ec_shell; var cymod = definition.cymod; var n = definition.n; var tol = definition.tol; var eclen = definition.eclen; var debugpoints = definition.debugpoints; // eclen = true; var e = ec_shell - cymod; var res = n * 35; var points = []; var tolD = D-tol; var x_1 =0; var y_1=0; for (var i = 0; i < res; i += 1) { var theta = (i / res) * 2 * PI * radian; var numer = sin((n)*theta); var dem = cos((n)*theta)-(tolD/(2*e*N)); var gamma = atan(numer/dem); var x = ((tolD / 2) * cos(theta)) - ((d_r / 2) * cos(theta + gamma)) - (e * cos(N * theta)); var y = ((-tolD / 2) * sin(theta)) + ((d_r / 2) * sin(theta + gamma)) + (e * sin(N * theta)); var x_0 = x; var y_0 = y; // println(ec_shell-cymod); if (eclen) { x_1 = (ec_shell-cymod)*cos(theta); y_1 = (ec_shell-cymod)*sin(theta); x = x + x_1; y = y + y_1; println("theta (rad): " ~ theta); println("cos(theta): " ~ cos(theta)); println("sin(theta): " ~ sin(theta)); // print("i val is "~i); // print("og x is "~x_0); // print("og y is "~y_0); // println("added x_1: " ~ x_1); // println("added y_1: " ~ y_1); // print("new x is "~x); // print("new y is "~y); } points = append(points, vector(x, y)); } points = append(points, points[0]); return points;
};