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

  • Home
  • SEARCH
  • 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 8858185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:46:13+00:00 2026-06-14T14:46:13+00:00

Im trying to allow users to draw a triangle shape. I’m getting the start

  • 0

Im trying to allow users to draw a triangle shape. I’m getting the start point and the end point and using the formula to find the third point of a equilateral triangle to create the triangle but it doesn’t seem to be working any ideas how I can do this? Maybe using a circle but I dont know how to go about that. Here is my current code.

NSValue *point = [_path objectAtIndex:0];
CGPoint startPoint = point.CGPointValue;

point = [_path lastObject];
CGPoint endPoint = point.CGPointValue;

 CGPoint thirdPoint = CGPointMake(((startPoint.x+endPoint.x)/2), (((startPoint.x-endPoint.x)/2)*(tan(60))+1));
 UIBezierPath *triangle = [UIBezierPath bezierPath];
 [triangle moveToPoint:startPoint];
 [triangle addLineToPoint:endPoint];
 [triangle addLineToPoint:thirdPoint];
 [triangle addLineToPoint:startPoint];
 triangle.lineWidth=size;
  • 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-14T14:46:15+00:00Added an answer on June 14, 2026 at 2:46 pm

    This should work to compute the third point of an equilateral triangle:

    CGPoint startPoint = ..., endPoint = ...;
    
    CGFloat angle = M_PI/3; // 60 degrees in radians
    // v1 = vector from startPoint to endPoint:
    CGPoint v1 = CGPointMake(endPoint.x - startPoint.x, endPoint.y - startPoint.y);
    // v2 = v1 rotated by 60 degrees:
    CGPoint v2 = CGPointMake(cosf(angle) * v1.x - sinf(angle) * v1.y,
                             sinf(angle) * v1.x + cosf(angle) * v1.y);
    // thirdPoint = startPoint + v2:
    CGPoint thirdPoint = CGPointMake(startPoint.x + v2.x, startPoint.y + v2.y);
    
    UIBezierPath *triangle = [UIBezierPath bezierPath];
    [triangle moveToPoint:startPoint];
    [triangle addLineToPoint:endPoint];
    [triangle addLineToPoint:thirdPoint];
    [triangle closePath];
    // ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to allow users to vote a record up/down with Ajax. I'm using
Im trying to allow users to login to a website by verifying if they
I'm trying to allow users to register on my web application via Facebook. As
I'm trying to allow users to input multiple id #'s separated by commas in
I'm trying to allow users to post videos on my site by supplying only
I'm trying to add a public API to my app to allow users to
I have been trying to integrate Facebook with my app to allow users to
I'm trying to develop a system that will allow users to update local, offline
I'm trying to create a dialog which will allow users to upload an image.
I am trying to create a small web app that will allow users to

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.