Skip to content

Conversation

@adam-urbanczyk
Copy link
Member

@adam-urbanczyk adam-urbanczyk commented Feb 23, 2019

This will resolve #91 . Also in principle #37 could be solved by this PR.

Sneak preview of the functionality:

import cadquery as cq
from math import sin, cos,pi,floor

def hypocycloid(t,r1,r2):
    return ((r1-r2)*cos(t)+r2*cos(r1/r2*t-t),(r1-r2)*sin(t)+r2*sin(-(r1/r2*t-t)))

def epicycloid(t,r1,r2):
    return ((r1+r2)*cos(t)-r2*cos(r1/r2*t+t),(r1+r2)*sin(t)-r2*sin(r1/r2*t+t))

def gear(t,r1=2,r2=1):
    if (-1)**(1+floor(t/2/pi*(r1/r2))) < 0:
        return epicycloid(t,r1,r2)
    else:
        return hypocycloid(t,r1,r2)

result = cq.Workplane('XY').parametricCurve(lambda t: gear(t*2*pi,6,1)).twistExtrude(15,90)
show_object(result)

afbeelding

@codecov
Copy link

codecov bot commented Feb 24, 2019

Codecov Report

Merging #110 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #110      +/-   ##
==========================================
+ Coverage   94.26%   94.29%   +0.02%     
==========================================
  Files          19       19              
  Lines        3922     3942      +20     
==========================================
+ Hits         3697     3717      +20     
  Misses        225      225
Impacted Files Coverage Δ
tests/TestCadQuery.py 98.77% <ø> (+0.01%) ⬆️
cadquery/cq.py 93.3% <100%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 158ba41...5f873da. Read the comment docs.

@adam-urbanczyk
Copy link
Member Author

I think it is ready for review. I made quite some changes to the spline function so please take a good look.

I also added one example to the docs.

Copy link
Member

@jmwright jmwright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. You're adding even more exiting functionality.

@adam-urbanczyk adam-urbanczyk requested review from jmwright and removed request for jmwright February 25, 2019 16:41
@dcowden
Copy link
Member

dcowden commented Feb 25, 2019

+1 for this, looks great and adds hotness too.

Copy link
Member

@dcowden dcowden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@adam-urbanczyk
Copy link
Member Author

@dcowden +1 for hotness : ). Merging.

@adam-urbanczyk adam-urbanczyk merged commit bf6e34d into master Feb 25, 2019
@adam-urbanczyk adam-urbanczyk deleted the adam-urbanczyk-parametric-curves branch June 15, 2019 16:53
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

Successfully merging this pull request may close these issues.

Construction of edges based on parametric equations

4 participants