Finding Tangents to a Curve
 1-9  10-29  30-49  50-61

Previous
Next
 From:  Barry-H
11632.30 In reply to 11632.29 
Hi Larry,
does the attached photo help or are your results different.
The bottom rollers are one side of material and the top the other.
Cheers
Barry


Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
11632.31 In reply to 11632.30 
Hi Barry,

Your results look correct, however mine are different (using NodeEditor Plus in case that matters):



In case I had messed something up, I just quit & relaunched however the result is the same as shown above.

--Larry

EDITED: 19 Jan by FAHNOE

Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Barry-H
11632.32 In reply to 11632.31 
Hi Larry,
found the issue I created the nod in the original nodeditor and your results come from using the new nodeditor plus.
Have updated nod file to work with the new nodeditor plus see original post.

Cheers
Barry

EDITED: 19 Jan by BARRY-H

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11632.33 
There are two orange nodes in the bend2 Bend Macro, offset and output.
Works well otherwise.

Now we need a bend2 icon for the NodeEditorPlus library.
Some sort of .png file.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11632.34 
I am unable to find documentation for crv.getTangentsToPoint( pt ), nor for crv.getTangentsToDir( dir ), although the second (method) has usage examples in scripts.
The forum was searched.
The MoI Wiki was searched, including the V4 and V5Beta pages.

These are V5 (methods or properties)?

I wonder if code blocks are searched?

Ctrl+F can be used to search the API and the Wiki.
In the API, highlight, right+click, and print seems to print selected text pretty well.

It looks like most of the V5 methods/properties are included in the API.


Petr's site seems to be unavailable?

- Brian

Edit: Note, the latest MoI v5 API DOES include documentation on these two crv.getTangents... methods!!!

EDITED: 21 Jan by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11632.35 In reply to 11632.34 
Hi Brian,

re:
> I am unable to find documentation for crv.getTangentsToPoint( pt ), nor for crv.getTangentsToDir( dir ),

Sorry it looks like they escaped documentation.

.getTangentsToPoint( pt ) and .getTangentsToDir( dir ) functions on curves and curve segments return a
list of a curve parameters where the curve is tangent to a given point or direction. In v5.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11632.36 In reply to 11632.35 
Thank you Michael

Today I learned about Browsing the Wiki and Resources pages, and about searching, and Search.
- B
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11632.37 In reply to 11632.35 
Brian made corrections to post 11632.34. MoI v5 API does have those two methods documented.
PEER had made the additions some months ago.
I do not know how or where they learned of the new methods.
I had an old copy on both computers.

- Brian

For closed curves, the GetTangents script( crv, dir ) will place an extra tangent point at the end of the curve (if it exists there).
I guess I can add code for if crv.isClosed, reduce params.length by 1, and not do the extra horizontal or vertical tangent point (if it exists there), for the end of the curve.(?)
To be tried later...
I need to learn about how this curve parameter thing works...Are there any recommended (NURBS?) references or forum information??

EDITED: 21 Jan by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11632.38 In reply to 11632.37 
Hi Brian,

re:
> I need to learn about how this curve parameter thing works...Are there any recommended (NURBS?) references
> or forum information??

NURBS references:
https://preserve.mactech.com/articles/develop/issue_25/schneider.html
https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline
https://www.rhino3d.com/features/nurbs/

A curve parameter is a numeric value that defines a location along the curve, ranging from the start of the curve being crv.domainMin to the end of the curve being crv.domainMax.

You can generate a cartesian x,y,z point value at a curve parameter by using crv.evaluatePoint( t ), or other information at that position with crv.evaluateTangent( t ), crv.evaluateCurvature( t ) or crv.evaluateDerivatives( t ).

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
11632.39 In reply to 11632.38 
The parameter business in the API was always a puzzle for me too, but with Michael's pointer to A Programmer's Geometry I'm starting to get a better sense of what's going on. Still have a mental gap between the equations given and MoI though. Relative to parameters, taking the diagram on pg 11, (x0, y0) is somewhere on the line (wherever the normal intersects) and seems from the code to be where t=0 (via algebra), however that does not then sync with parameter values ranging from 0 to 1 to describe the complete line. Makes me wonder if the t parameters are interpreted differently in different forms of equations? My computed tangents do not look correct and are winding up in screwy locations, so I'm still going over my code.

The other puzzlement is how to update the equations and code for the implicit form (section 2) to include the 3rd dimension. Book seems to give hints later on when it gets into lines and planes in space (section 7).

Paging back & forth in the PDF inspired me to order a used copy yesterday. Gotta love bookfinder.com to find good prices on used books, in this case about $7 delivered. Even though I'm in way over my head, I very much appreciate these pearls of wisdom Michael, thank you! Schneider in particular looks to be very worthwhile to better appreciate how these things work...

--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11632.40 In reply to 11632.39 
The 4 tangent points can be ("easily") calculated with trigonometry equations, as detailed at stack exchange forum.
These equations may be the ones used in Barry's node???
-Brian

I will post the link later.

Re: 3d geometry:
If one View is stuck to, say Front view, xz plane, y is zero, and z plays the role of Y in equations.

A cplane could be set, with two circle centers, with z = 0, calculations done, and then the tan points translated back to World coordinates. (poorly understood by myself).

If the rollers are restricted to xy or xz, or yz, the circle or arc curves could use a couple of isPlaner and another method to differentiate between, I think (???)
( I find the cPlane conversions puzzling / confusing)

- Brian

EDITED: 21 Jan by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
11632.41 In reply to 11632.40 
Hi Brian,

With the leg up from your initial code, I had the generalized 3D version working to produce the tangent points in short order. My brain revolted when I tried to understand the node though. Will look forward to your link.

When trying to work with the 2D equations from the book, my thought was to also try for the generalized 3D solution as well. I think the coordinateFrame from the two circles provides the key information about which view is involved, and that code based upon this information would then work naturally with a cPlane as well. Given how much self awareness the MoI objects have, to my mind it is tantalizing to be able to feed that context into these equations to get new MoI objects without my clumsy attempts to explicitly map a particular view. (if that makes sense)

For what it's worth, here's my 3D modification to your initial code example:

code:
function GetInnerHomotheticPt( circle1, circle2 )
{
    if (( circle1.isArc || circle1.isCircle ) &&
        ( circle2.isArc || circle2.isCircle )) {
        var centerPt1 = circle1.conicFrame.origin;    
        var centerPt2 = circle2.conicFrame.origin;
        var radiusSum = circle1.conicRadius + circle2.conicRadius;
        var ratio1 = circle1.conicRadius / radiusSum;
        var ratio2 = circle2.conicRadius / radiusSum;
        var x0 = ratio2 * centerPt1.x + ratio1 * centerPt2.x;
        var y0 = ratio2 * centerPt1.y + ratio1 * centerPt2.y;
        var z0 = ratio2 * centerPt1.z + ratio1 * centerPt2.z;
        var pt = moi.vectorMath.createPoint( x0, y0, z0 );
        return pt;
    }
}

function GetTangents( crv, pt )
{
    var params = crv.getTangentsToPoint( pt );
    for ( var i = 0; i < params.length; ++i )
    {
	var pt = crv.evaluatePoint( params.item( i ) );
	var factory = moi.command.createFactory( 'point' );
	factory.setInput( 0, pt );
	factory.commit();
    }
}

// then in the calling function

    var ptInner1 = GetInnerHomotheticPt( botDie1, topDie );
    GetTangents( botDie1, ptInner1 );
    GetTangents( topDie, ptInner1 );

    var ptInner2 = GetInnerHomotheticPt( botDie2, topDie );
    GetTangents( botDie2, ptInner2 );
    GetTangents( topDie, ptInner2 );



--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11632.42 In reply to 11632.41 
Calculating tangent points with Trig. link:
https://math.stackexchange.com/questions/719758/inner-tangent-between-two-circles-formula

Hi Larry,

Congrats on your new script!
I see that you used the new beta v5 crv.getTangentsToPoint( pt ) method.
I need study and try out your script.

I did not know that the ratios worked in 3d.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11632.43 In reply to 11632.41 
??? An extra point might be created with a (closed) circle, if the tangent happens to occur where the curve start point equals the curve end point. (Seam in extruded circle) ???

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11632.44 In reply to 11632.43 
A line factory can be used to create the line segment tangents, from pairs of points.
- b
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
11632.45 In reply to 11632.42 
Hi Brian,

Thanks for the link! One of the cool things about the book's code is that it also seeks to be computationally efficient...avoiding the expensive operations like the trig functions. Not that this really matters in this context, just shows that I'm old & have an appreciation of why fast code is worthwhile.

Here's the current effort but only because you mentioned trying it. Nowhere near complete...

--Larry

EDITED: 21 Jan by FAHNOE

Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11632.46 In reply to 11632.45 
Terrific script.

For the top die, the tangent points of interest lie "below" its centerpoint. (?)
A short arc can be built between these two points.

For the bottom dies, the tangent points of interest lie "below" their centerline. (?)

If the "seams" (join point) of the circles are placed in the proper positions, and the circles are in the proper orientation [ CounterClockwise left die with Clockwise upper die ], or [ CW right die with CCW upper die ], then the first tangent point encountered for each circle will be the desired one, pairwise. The seams should be closest to the centerline midpoint. Which is the lowest point on the upper die circle, and innermost point of the outer two dies. ( This might be the midpoint of the upper die? )

Does MoI have any ways to determine CW vs CCW for the circles?, or arcs?

image host

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11632.47 In reply to 11632.46 
Hi Brian,

re:
> Does MoI have any ways to determine CW vs CCW for the circles?, or arcs?

If you get 3 distinct points on the arc (on a circle don't get start/mid/end because start and end are the same), you can then calculate the signed area of the 2D triangle which will be negative for clockwise order, positive for counter-clockwise.

Script code for calculating this is here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=11521.42

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
11632.48 In reply to 11632.47 
Thank you Michael.

So if Larry decides to use CW vs CCW, the dies only need to be set up once, which can be done before tangent scripts are used...

The parametric order of crv.getTangentsToPoint( pt ) would be from circle start to circle end, around the circle. Or from arc startPt to arc endPt, around the arc.(?)
CW FLIPS to CCW (?)

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
11632.49 In reply to 11632.48 
Once again, you guys are way out ahead & I'm the lucky beneficiary, thank you both.

--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-9  10-29  30-49  50-61