1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Norma-Jean [14]
3 years ago
10

Consider the clipping of a line segment in two dimensions against a rectangular clipping window. Show that you require only the

endpoints of the line segment to determine whether the line segment is not clipped, is partially visible, or is clipped out completely.

Computers and Technology
1 answer:
Semmy [17]3 years ago
6 0

Answer / Explanation:

Assuming we define the end points as ( x₁ , y₁) and (x₂ , y₂) and the rectangular window edge as ( Xmin ,Ymin and Xmax , Ymax)

The illustration of the above assumption is represented in the diagram below.

Now, suppose the line segment is between the points P₁ = ( x₁ , y₁) , and

P₂ = (x₂ , y₂).

We can then create a line recalling and using parametric form,

P(t) = ( 1 - t) P₁ + tP₂ , t ∈ {0 , 1 },

So, for the X axis, we have,

tₓ = P₁ₓ - x ÷ P₁ₓ - P₂ₓ

We need to note that at this point we need to know the minimum and maximum unclipped  values for parameter t from each dimension.

Therefore,

- ( tmin , tmax ) = ( 0,1) means unclipped line

-tmin > tmax means completely clipped out line

– Some other range means partially clipped out line.

You might be interested in
Write a class named GasTank containing: An instance variable named amount of type double, initialized to 0. An instance variable
telo118 [61]

Answer:

The class GasTank is defined below

All the steps are briefed in comments

public class GasTank {

// instance variable initialization

private double amount = 0;

//declaring instance variable capacitance

private double capacity;

//constructor having parameter of type double

public GasTank(double i)

{

capacity = i;

}

// addGas method for increasing gas quantity.

public void addGas(double i)

//quantity of gas increased is added to the existing amount. If it becomes more than total capacity, amount is set to capacity

{ amount += i; if(amount > capacity) amount = capacity; / amount = amount < capacity ? amount+i : capacity;/ }

//useGas method having parameter of type double

public void useGas(double i)

//the parameter given is deducted from 0 and if results less than 0, remains equal to 0

{ amount = amount < 0 ? 0 : amount - i; }

//method isEmpty

public boolean isEmpty()

//Returns true if volume is less than 0.1 else false

{ return amount < 0.1 ? true : false; }

//method isFull

public boolean isFull()

//returns true if the value of amount is greater than  0.1 else false.

{ return amount > (capacity-0.1) ? true : false; }

//method getGasLeve

public double getGasLevel()

//Returns the value of amount instance variable

{ return amount; }

//method fillUp

public double fillUp()

//returns the difference between the capacity and the amount

{ double blah = capacity - amount; amount = capacity; return blah; }

}

5 0
3 years ago
Name the design tool that can be used to establish a spatial hierarchy of the content
rewona [7]

Typography is a tool that can be used to establish a spatial hierarchy of the content.

6 0
3 years ago
Read 2 more answers
Write a code in C++ that can save 100 random numbers in an array that are between 500 and 1000. You have to find the average of
Anni [7]

Answer:

#include <iostream>

#include <random>

//here we are passing our array and a int by ref

//to our function called calculateAverage

//void is infront because we are not returning anything back

void calculateAverage(int (&ar)[100], int &average){

 int sum = 0;

 for(int i = 0;i < 100; i++){

   //adding sum

   sum += ar[i];

 }

 //std:: cout << "\naverage \t\t" << average;

//calculating average here

 average += sum/100;

}

int main() {

 int value = 0;

 int average = 0;//need this to calculate the average

 int ar[100];

 //assign random numbers from 500 to 1000

 //to our array thats called ar

 for(int i = 0; i < 100; i++){

   value = rand() % 500 + 500;

   ar[i] = value;

   

 }

 calculateAverage(ar,average);

 // std:: cout << "\naverage should be \t" << average;

 

}

Explanation:

not sure how else this would work without having to pass another variable into the function but I hope this helps!

I commented out the couts because you cant use them according to ur prof but I encourage you to cout to make sure it does indeed calculate the average!

3 0
2 years ago
How is binary number related to real number?
Bogdan [553]

Answer:

.....................????..?..

7 0
2 years ago
Read 2 more answers
______ are segments of computer code that attach to existing computer programs and perform malicious acts. select one:
Ann [662]
The best answer is A, viruses.
5 0
3 years ago
Other questions:
  • What kind of game was Pole Position?
    14·1 answer
  • 1.What is Intellectual Property
    9·1 answer
  • Explain why living things store energy in lipids instead of in carbohydrates
    5·1 answer
  • Who is the last person appointed to the u.s supreme court
    11·1 answer
  • What kind of resources can we share over the network? Plzzzzzzzz help!!!!!!
    10·2 answers
  • You need to find out more about the fdisk utility and the commands associated with it before you set up a new Linux system in ad
    15·1 answer
  • What are the vitamins used for DNA Synthesis and Repair?​
    11·1 answer
  • Brainliest to right answer.
    10·1 answer
  • Explain the importance of understanding plagiarism, copyright, and fair use during a time when some much of your schoolwork is d
    7·1 answer
  • Helen is filling her persönal details on her résumé. Which detail should she include in this section?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!