Finding points of intersection with a vector


#1

hey,

I would sincerely appreciate any guidance. codeing language vb.net based rhinoscripting

Scenario and Problem:

  • Lets say I have an oval shape.
    -I drew a line exactly in the center of it and i have the mid point of that line as well as the point coordinates of the points of intersection on the oval
    -I wanted to rotate that line by 20 degrees (clockwise and anti clockwise) resulting in a 40 degree rotation on either side of the mid point of the center line with the circumference of the oval (its a curve).
    -Since rhinoscripting (vb.net) does not allow a line to be rotated, I created a vector with the two points which intersect the oval and maintained the mid point of it as a centre of roation with an axis in the Z direction (asuming the oval and the line,vector is on the XY plane)
    Problem:
    -rotating the vector at the desired angles such that i can obtain both the points of intersection at both the intersection points. (next step after rhino.vectorrotate)
    :the aim is rotate the vector until the smallest distance between the intersecting points are obtained
    (to do this step, a
    rhino.vectorrotate(intersectingpoints,20,zaxis)
    "for loop is used:
    distance=9999
    for t=0 to 159
    testlength=rhino.vectorlength or rhino.curvelength
    if testlength(lesserThanSymbol)distance
    distance=testlength
    iteration=t
    End if
    rhino.vectorrotate(intersectionpoints,-0.5,zaxis)
    next
    -add points on either end of that vector which represents the smallest distance and draw a line through it.(drawing a line through the points is a walk in the park,but obtaining those points is the problem)

kindly advise,


(Menno Deij - van Rijswijk) #2

Changed category to “Developer”


(Menno Deij - van Rijswijk) #3

Could you add a drawing or 3dm document to outline what you want in more detail? If find your message hard to follow, I’m afraid.


#4

pseudo code for a visual understanding…rvb (2.0 KB) testobject.3dm (484.1 KB)


(Menno Deij - van Rijswijk) #5

Sorry, I don’t know how to help you with this.


(Dale Fugier) #6

Use Rhino.RotateObject.

One way of doing this is to create a long line so it is assured to intersect the ellipse. Then, just intersect the line with the ellipse using either Rhino.LineCurveIntersection or Rhino.CurveCurveIntersection, and then just trim off the overhanging end piece using Rhino.TrimCurve.