Create an array for outputting triangles

Assignment Help Computer Engineering
Reference no: EM133285061

Create this function

public static Triangle[] makeFakePoly(Point[] points)

The purpose of the makeFakePoly is to create arrays of triangles that can be used to draw more complicated polygons. The function takes an array of points. You can assume this array has at least 3 points in it. The function should return an array of triangles. Important - there are MANY ways to do this which would work in general. Our tests, however, are designed to look for one specific solution approach, which is outlined here. If you want to pass tests you will have to be careful to follow this pseudocode

Question 1. Create an array for outputting triangles. Ultimately this will need to be the same length as the input point array.

Question 2. Compute the "center point"

Question 3. for each array index i create a new triangle using p1 = points[i], p2 = points[i+1], p3 = center (For the final position, p1 = points[N - 1], p2 = points[0], p3 = center)

Question 4. return the new array

So if we gave the function the points [(1, 1),(1, 2),(2, 2),(2, 1)] it should return the 4 triangles (in this order): (1, 1) - -(1, 2) - -(1.5, 1.5) (1, 2) - -(2, 2) - -(1.5, 1.5) (2, 2) - -(2, 1) - -(1.5, 1.5) (2, 1) - -(1, 1) - -(1.5, 1.5)

Reference no: EM133285061

Questions Cloud

Calculate the derivative : Find the minimum of a function you must calculate the derivative and make it = 0. In the case of the function y the derivative is 2x - 2
Change the foreground color of a jlabel text : CSS 222 Eastern Gateway Community College How am I able to change the foreground color of a JLabel text with clicking a JButton using an Action Event Handlers
What will be the state of the bht after bubble : What will be the state of the BHT after bubble() with the optimized inner loop is called with a 10-element array sorted in ascending order
What accounts for the subprime financial turmoil : What accounts for the subprime financial turmoil that burst onto the scene in the summer of 2007? Who is most to blame for this mess
Create an array for outputting triangles : CS 200 Cavite State University - Bacoor Campus Create an array for outputting triangles. Ultimately this will need to be the same length as the input point
Which supply chain efficiency can be improved : Assume yourself as an advisor of Supply chain discipline, suggest ways and means through which supply chain efficiency can be improved
Write a complete java program : Write a complete Java Program that will ask for an integer-type input and check whether the given input is greater than 50 or not. If greater than 50
Summarize videos content in a ppt file : Watch two iBiology videos about DNA replication: Summarize their content in a ppt file (no more than 20 slides), accompanied by a short narrative
How healthcare provider-primary care can be nonjudgmental : How the healthcare provider and primary care can be nonjudgmental and ethical while providing access to care for homeless and mentally ill individuals.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Produce the opencl kernel and the application driver

Re-write the bitcoin mining kernel using funnel shift intrinsics and measure its performance using the modified GPGPU-sim with funnel shift support. Can bitcoin mining performance be improved significantly using the dedicated hardware support for ..

  Determine the longest possible interval

Determine the longest possible interval [L, R] so that if GapEst is in this interval, then the 10 required conjunctions are computed in FindConj.

  Explain what is meant by an ids and an ips

In no less than 250 words, explain what is meant by an IDS and an IPS. How are they different? How are they connected to a network? List a few examples.

  Prove that the statement is valid using a proof sequence.

CS 415 University of Phoenix prove that the statement is valid using a proof sequence - Some drinks served at the Green Ferret Cafe include hazelnut

  How would training occur for your team

Industry experts believe blockchain is a technology that has the potential to affect the business of most IT professionals in the next five years.

  Design a logical right-shift register

Design a logical right-shift register using JK flip-flop. Parallel load the input 101011 into your circuit. Show all different clock cycles of the outputs from 101011 to 000000

  Determine the address map of the given system

Consider the hardware schematic shown in Figure.

  Pros and cons of the model-view-controller

define the benefits and limitations of the model-view-controller (MVC) principle. Identify one way in which MVC helps software designers create better code, and one way in which it deters them.

  Write the algorithm for push in a linked implementation

Write the algorithm for Push in a linked implementation. Write the algorithm for Pop in a linked implementation.

  For the sr-nand and sr-nor latches derive

For the SR-NAND and SR-NOR latches derive - Characteristic tables

  Make an application named numbers

make an application named Numbers. The Numbers class should have non-static public methods named sum and difference, each taking a pair of int variables as arguments.

  Propose a ip network scheme to accommodate the needs

Propose a IP network scheme to accommodate the needs of the office above. Your proposal should incorporate the most efficient use of network/host using VLSM and a second option using FLSM. Provide pluses and minuses for each option.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd