How to resolve the algorithm Superellipse step by step in the QBasic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Superellipse step by step in the QBasic programming language

Table of Contents

Problem Statement

A superellipse is a geometric figure defined as the set of all points (x, y) with

where n, a, and b are positive numbers.

Draw a superellipse with n = 2.5, and a = b = 200

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Superellipse step by step in the QBasic programming language

Source code in the qbasic programming language

SCREEN 12
CLS
a = 200
b = 200
n = 2.5
na = 2 / n
t = .01

LINE -(520, 245), 0, BF
FOR i = 0 TO 314
    xp = a * SGN(COS(t)) * ABS((COS(t))) ^ na + 320
    yp = b * SGN(SIN(t)) * ABS((SIN(t))) ^ na + 240
    t = t + .02
    LINE -(xp, yp), 1, BF
NEXT i


  

You may also check:How to resolve the algorithm Dice game probabilities step by step in the Ada programming language
You may also check:How to resolve the algorithm Power set step by step in the Scheme programming language
You may also check:How to resolve the algorithm File size step by step in the Run BASIC programming language
You may also check:How to resolve the algorithm Erdős-Nicolas numbers step by step in the Phix programming language
You may also check:How to resolve the algorithm Repeat a string step by step in the Aime programming language