Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8691651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:09:49+00:00 2026-06-13T00:09:49+00:00

I have two lines, one straight and one curvy. Both have an arbitrary number

  • 0

I have two lines, one straight and one curvy. Both have an arbitrary number of x and y values defining the lines – the number of x and y values are not the same for either line. I am attempting to get separate distances of points between the curved line coordinates and the straight line coordinates. You can think of discrete integration to get a better picture of what I’m talking about, something along the lines of this: http://www.scientific-solutions.ch/tech/origin/products/images/calculus_integral.gif

By adding the different distances, I would get the area. The part on which I am stuck is the actual synchronization of the points. I can simply compare the x and y values of the straight and curve coordinates every ten indices for example because the curved coordinates are time dependent (as in the points do not change at a general rate). I need a way to synchronize the actual coordinates of the two sets of points. I thought about interpolating both sets of points to a specific number of points, but again, the time dependence of the curved set of points makes that solution void.

Could someone please suggest a good way of doing this, outlining the basics? I really appreciate the help.

Code to be tried (pseudo):

xLine = [value1 value2 ...]
yLine = [value1 value2 ...]
xCurve = [value1 value2 ...]
yCurve = [value1 value2 ...]

xLineInterpolate = %interpolate of every 10 points of x until a certain value. same with yLineInterpolate, xCurveInterpolate and yCurveInterpolate.

Then, I could just take the same index from each array and do some algebra to get the distance. My worry is that my line values increase at a constant rate whereas my curve values sometimes do not change (x and y values have different rates of change) and sometimes do. Would such an interpolation method be wrong then?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:09:50+00:00Added an answer on June 13, 2026 at 12:09 am

    If I understand correctly, you want to know the distance between a straight line and a curve. The easiest way is to perform a coordinate transformation such that the straight line is the new x-axis. In that frame, the y-values of the curved line are the distances you seek.

    This coordinate transformation is equal to a rotation and a translation, as in the following:

    % estimate coefficients for straight line
    sol = [x1 ones(size(x1))] \ y1;
    m = sol(1); %# slope
    b = sol(2); %# y-offset at x=0
    
    % shift curved line down by b 
    % (makes the straight line go through the origin)
    y2 = y2 - b;
    
    % rotate the curved line by -atan(m)
    % (makes the straight line run parallel to the x-axis)
    a = -atan(m);
    R = [+cos(a) -sin(a)
         +sin(a) +cos(a)];    
    XY = R*[x2; y2];
    
    % the distances are then the values of y3. 
    x3 = XY(1,:);
    y3 = XY(2,:);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file named file with three lines: line one line two line
Say I have two files where there is one number per line File 1
I have a figure including two lines (one horizontal line, and one parabolic curve),
I have two links, one with id #calendar_arrival_open and another with #calendar_departure_open. Both links
I have one line (two point (x,y) (x1,y1)) and a rectangle with focus point
Say I have a file, t.txt, that contains the following two lines: one two
I have two arrays the store the values of two lines that are read
I have two lines one horizontal and one vertical, I have the equations of
I have two lines that have space between them. Like the one below.... <h2>
How can I draw a straight line between two UIImageViews and have the line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.