You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see some notes on a desire to improve the quality of curves for the thread simulations.
I haven't got a cut and paste answer for you, but:
When using catmull, its going to be difficult - even if you use tension to try to control the sharpness of the curve.
A more stable solution would, IMHO, be to use cubic Bezier curve. (there's a quick way to calc the control points)
In Three.js this is a CubicBezierCurve3 It has two control points instead of none in a catmull (or one for a quadratic).
The use of two will give you the control you need to make the threads behave much better.
The format is CubicBezierCurve3( pt1, c1, c2, pt2). The c points are simply calculated. You already have the pt points.
The full curve has to become a curvepath with a new CubicBezierCurve3 for each of the points in your current catmullrom curve.
Thread style layout:
Here's a diagram showing "the" layout to simulate a thread in warp or weft. - using an online bezier curve toy. I marked it up for two curves using three primary datapoints (I think your simdata is in this P1,P2,P3 form)
The two curves are completely separate. You will need to use a Three.js curvepath entity which can have a sequence of curves in it.
The diagram shows curve 1 and curve2. The pt1 of curve2 uses a vector3 copy of pt2 from curve1.
It comes from here - where you can play with values (its a difficult UI but doable)
The pt1, pt2 are the same points you have in your simulation (I am pretty sure this is right)
Then you need to calculate the control points. This might seem daunting but its luckily quite simple:
The diagram shows the trick
you need to put the control points directly above and in line with each other.
The distance they go in Y can be determined by the thickness of the tube(thread) you are using.
I have used thin blue lines rather than simulate the thicker yarn line.
The thread will form a convex hull inside this height (not exceeding it). 99% of time this is what you want for woven threads.
if you make this Y_cpt_offset be a variable you can calculate it in the scope of a given scene. (E.g. 3x Yarn diameter)
Later on you could perturb this control point to simulate deflected double weave etc....
So you'd be adding curves to a curvepath. Each curve would be a CubicBezierCurve3 with reused/shared end and start pts.
And each curve would have two control points added with simple Y_cpt_offset added to those same end/start points.
Hope this helps. Sorry I could not set my machine up to compile this and so submit a PR instead of this message.
The text was updated successfully, but these errors were encountered:
Here's a better sim showing thread diameter related to control point height.
You can, of course, add an on-screen control to exaggerate it for clarity (or a thread diameter slider might be even better to show the path of a complex route)
Thank you so much for this suggestion. I really appreciate it. The simulation features have been on hold for a bit while I prep and bug fix other parts of what is now the beta, but will soon be the official branch of AdaCAD. I'm hoping in jump back into simulation rendering and parsing in Fall 2025. I know....it feels a way off...but that might be the next time I have the space and attention to dive back into it.
I see some notes on a desire to improve the quality of curves for the thread simulations.
I haven't got a cut and paste answer for you, but:
When using catmull, its going to be difficult - even if you use tension to try to control the sharpness of the curve.
A more stable solution would, IMHO, be to use cubic Bezier curve. (there's a quick way to calc the control points)
In Three.js this is a
CubicBezierCurve3
It has two control points instead of none in a catmull (or one for a quadratic).The use of two will give you the control you need to make the threads behave much better.
The format is
CubicBezierCurve3( pt1, c1, c2, pt2)
. Thec
points are simply calculated. You already have thept
points.The full curve has to become a
curvepath
with a newCubicBezierCurve3
for each of the points in your currentcatmullrom
curve.Thread style layout:
Here's a diagram showing "the" layout to simulate a thread in warp or weft. - using an online bezier curve toy. I marked it up for two curves using three primary datapoints (I think your simdata is in this P1,P2,P3 form)
The two curves are completely separate. You will need to use a Three.js
curvepath
entity which can have a sequence ofcurves
in it.The diagram shows curve 1 and curve2. The pt1 of curve2 uses a vector3 copy of pt2 from curve1.
It comes from here - where you can play with values (its a difficult UI but doable)
Control points:
The pt1, pt2 are the same points you have in your simulation (I am pretty sure this is right)
Then you need to calculate the control points. This might seem daunting but its luckily quite simple:
Y_cpt_offset
be a variable you can calculate it in the scope of a given scene. (E.g. 3x Yarn diameter)Here's a relevant snippet from your code:
So you'd be adding curves to a
curvepath
. Each curve would be aCubicBezierCurve3
with reused/shared end and start pts.And each curve would have two control points added with simple
Y_cpt_offset
added to those same end/start points.Hope this helps. Sorry I could not set my machine up to compile this and so submit a PR instead of this message.
The text was updated successfully, but these errors were encountered: