Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to draw smooth curves (Bezier Curves) etc #593

Open
lalamax3d opened this issue Sep 26, 2023 · 1 comment
Open

is it possible to draw smooth curves (Bezier Curves) etc #593

lalamax3d opened this issue Sep 26, 2023 · 1 comment

Comments

@lalamax3d
Copy link

i have found , it looks ok.

points = [Vec3(0,0,0), Vec3(0,5,0), Vec3(3,2,0), Vec3(6,4,0)]
curve_renderer = Entity(model=Mesh(vertices=points, mode='line',  thickness=3))

Q. is it possible to make another mode ('curve') in Entity. if same data is given ( points in array) and mode is curve, it draws smooth curves..

@onesome88
Copy link

onesome88 commented Aug 1, 2024

Not exactly what you wanted, but it can render curve functions.

class Curve(Mesh):
    def __init__(self,func,detail:int=20):
        super().__init__(vertices=[Vec3(t/detail,func(t/detail),0) for t in range(detail+1)],mode="line")
curve_renderer = Entity(model=Curve(curve.in_out_cubic))

give it higher detail to make the model more detailed, func is whatever curve function you want
for example, for a cubic bezier, it would be something like

c = curve.CubicBezier(.85,.1,.15,1)
Entity(model=Curve(c.calculate))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants