Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
thumb_up100%
Using comments within the code itself, can you provide an line by line explanation of the below JavaScript file? The file itself deals with WebGl and if that helps you.
Please & thank you
JavaScript File:
function inverse2(m)
{
var a = mat2();
var d = det2(m);
a[0][0] = m[1][1]/d;
a[0][1] = -m[0][1]/d;
a[1][0] = -m[1][0]/d;
a[1][1] = m[0][0]/d;
return a;
}
function inverse3(m)
{
var a = mat3();
var d = det3(m);
var a00 = [
vec2(m[1][1], m[1][2]),
vec2(m[2][1], m[2][2])
];
var a01 = [
vec2(m[1][0], m[1][2]),
vec2(m[2][0], m[2][2])
];
var a02 = [
vec2(m[1][0], m[1][1]),
vec2(m[2][0], m[2][1])
];
var a10 = [
vec2(m[0][1], m[0][2]),
vec2(m[2][1], m[2][2])
];
var a11 = [
vec2(m[0][0], m[0][2]),
vec2(m[2][0], m[2][2])
];
var a12 = [
vec2(m[0][0], m[0][1]),
vec2(m[2][0], m[2][1])
];
var a20 = [
vec2(m[0][1], m[0][2]),
vec2(m[1][1], m[1][2])
];
var a21 = [
vec2(m[0][0], m[0][2]),
vec2(m[1][0], m[1][2])
];
var a22 = [
vec2(m[0][0], m[0][1]),
vec2(m[1][0], m[1][1])
];
a[0][0] = det2(a00)/d;
a[0][1] = -det2(a10)/d;
a[0][2] = det2(a20)/d;
a[1][0] = -det2(a01)/d;
a[1][1] = det2(a11)/d;
a[1][2] = -det2(a21)/d;
a[2][0] = det2(a02)/d;
a[2][1] = -det2(a12)/d;
a[2][2] = det2(a22)/d;
return a;
}
function inverse4(m)
{
var a = mat4();
var d = det4(m);
var a00 = [
vec3(m[1][1], m[1][2], m[1][3]),
vec3(m[2][1], m[2][2], m[2][3]),
vec3(m[3][1], m[3][2], m[3][3])
];
var a01 = [
vec3(m[1][0], m[1][2], m[1][3]),
vec3(m[2][0], m[2][2], m[2][3]),
vec3(m[3][0], m[3][2], m[3][3])
];
var a02 = [
vec3(m[1][0], m[1][1], m[1][3]),
vec3(m[2][0], m[2][1], m[2][3]),
vec3(m[3][0], m[3][1], m[3][3])
];
var a03 = [
vec3(m[1][0], m[1][1], m[1][2]),
vec3(m[2][0], m[2][1], m[2][2]),
vec3(m[3][0], m[3][1], m[3][2])
];
var a10 = [
vec3(m[0][1], m[0][2], m[0][3]),
vec3(m[2][1], m[2][2], m[2][3]),
vec3(m[3][1], m[3][2], m[3][3])
];
var a11 = [
vec3(m[0][0], m[0][2], m[0][3]),
vec3(m[2][0], m[2][2], m[2][3]),
vec3(m[3][0], m[3][2], m[3][3])
];
var a12 = [
vec3(m[0][0], m[0][1], m[0][3]),
vec3(m[2][0], m[2][1], m[2][3]),
vec3(m[3][0], m[3][1], m[3][3])
];
var a13 = [
vec3(m[0][0], m[0][1], m[0][2]),
vec3(m[2][0], m[2][1], m[2][2]),
vec3(m[3][0], m[3][1], m[3][2])
];
var a20 = [
vec3(m[0][1], m[0][2], m[0][3]),
vec3(m[1][1], m[1][2], m[1][3]),
vec3(m[3][1], m[3][2], m[3][3])
];
var a21 = [
vec3(m[0][0], m[0][2], m[0][3]),
vec3(m[1][0], m[1][2], m[1][3]),
vec3(m[3][0], m[3][2], m[3][3])
];
var a22 = [
vec3(m[0][0], m[0][1], m[0][3]),
vec3(m[1][0], m[1][1], m[1][3]),
vec3(m[3][0], m[3][1], m[3][3])
];
var a23 = [
vec3(m[0][0], m[0][1], m[0][2]),
vec3(m[1][0], m[1][1], m[1][2]),
vec3(m[3][0], m[3][1], m[3][2])
];
var a30 = [
vec3(m[0][1], m[0][2], m[0][3]),
vec3(m[1][1], m[1][2], m[1][3]),
vec3(m[2][1], m[2][2], m[2][3])
];
var a31 = [
vec3(m[0][0], m[0][2], m[0][3]),
vec3(m[1][0], m[1][2], m[1][3]),
vec3(m[2][0], m[2][2], m[2][3])
];
var a32 = [
vec3(m[0][0], m[0][1], m[0][3]),
vec3(m[1][0], m[1][1], m[1][3]),
vec3(m[2][0], m[2][1], m[2][3])
];
var a33 = [
vec3(m[0][0], m[0][1], m[0][2]),
vec3(m[1][0], m[1][1], m[1][2]),
vec3(m[2][0], m[2][1], m[2][2])
];
a[0][0] = det3(a00)/d;
a[0][1] = -det3(a10)/d;
a[0][2] = det3(a20)/d;
a[0][3] = -det3(a30)/d;
a[1][0] = -det3(a01)/d;
a[1][1] = det3(a11)/d;
a[1][2] = -det3(a21)/d;
a[1][3] = det3(a31)/d;
a[2][0] = det3(a02)/d;
a[2][1] = -det3(a12)/d;
a[2][2] = det3(a22)/d;
a[2][3] = -det3(a32)/d;
a[3][0] = -det3(a03)/d;
a[3][1] = det3(a13)/d;
a[3][2] = -det3(a23)/d;
a[3][3] = det3(a33)/d;
return a;
}
function inverse(m)
{
if(!isMatrix(m)) throw("inverse: m not a matrix");
if(m.length == 2) return inverse2(m);
if(m.length == 3) return inverse3(m);
if(m.length == 4) return inverse4(m);
}
//---------------------------------------------------------
// normal matrix
function normalMatrix(m, flag)
{
if(m.type!='mat4') throw "normalMatrix: input not a mat4";
var a = inverse(transpose(m));
if(arguments.length == 1 &&flag == false) return a;
var b = mat3();
for(var i=0;i<3;i++) for(var j=0; j<3; j++) b[i][j] = a[i][j];
return b;
}
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 3 steps
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In Python IDLE: In the attached image is a class. I have used highlighter to outline a small segment of the code. I want to know- what does this portion of code do? What is the purpose of this code segment? Why do I need this peice of code?arrow_forwardWrite a Java program that accomplishes the same thing as the program in the pictures, except by using two dimensional arrays instead.arrow_forwardconvert this code to JAVA location = [] size = [] rover = 0 def displayInitialList(location, size): global rover print("FSB# location Size") for i in range(len(location)): print(i," ",location[i]," ",size[i]) if rover<len(size)-1: print("Rover is at ",location[rover+1]) else: print("Rover is at ",location[rover]) def allocateMemory(location,size,blockSize): global rover if rover<len(size): while size[rover]<blockSize: rover+=1 if i==len(size): return False location[rover] += blockSize size[rover] -= blockSize rover+=1 return True else: return False def deallocateMemory(location,size,delLocation,delSize): i=0 while delLocation>location[i]: i+=1 location[i]-=delSize size[i]+=delSize while True: print("1. Define Initital memory\n2. Display initial FSB list\n3. Allocate memory\n4. Deallocate memory\n5. Exit") print("Enter choice: ",end="") choice = int(input()) if...arrow_forward
- The java program ArrayTest.java is intended to do the following: • Fill the array a with integer values input from the file ints.txt. • (Shift-right) Shift the elements of a to the right one position and put the last element of array a in the first position in a (wrap around). Example: if a originally contained (1, 2, 3, 4} then the resulting array a would be (4, 1, 2, 3} What command would be given on the command line to redirect the input to the program ArrayTest to come from the text file ints.txt? Enter your answer herearrow_forwardIm trying ro read a csv file and store it into a 2d array but im getting an error when I run my java code. my csv file contains 69 lines of data Below is my code: import java.util.Scanner; import java.util.Arrays; import java.util.Random; import java.io.File; import java.io.FileNotFoundException; import java.io.FilenameFilter; public class CompLab2 { public static String [][] getEarthquakeDatabase (String Filename) { //will read the csv file and convert it to a string 2-d array String [][] Fileinfo = new String [69][22]; int counter = 0; File file = new File(Filename); try { Scanner scnr = new Scanner(file); scnr.nextLine(); //skips the label in the first row of the file while (scnr.hasNextLine()) { // this while loop will count the number of values in the usgs file counter += 1; // increases by one each time a line is read scnr.nextLine(); } while...arrow_forwardIn java plsarrow_forward
- What are the Javadoc comments for each class? I am strugglingarrow_forwardHere are what to display on your Pokémon's show page: The pokemon's name The image of the pokemon An unordered list of the Pokemon's types (eg. water, poison, etc). The pokemon's stats for HP, ATTACK, and DEFENSE. module.exports = [ { id: "001", name: "Bulbasaur", img: "http://img.pokemondb.net/artwork/bulbasaur.jpg", type: [ "Grass", "Poison" ], stats: { hp: "45", attack: "49", defense: "49", spattack: "65", spdefense: "65", speed: "45" }, ]; Routes Your app should use RESTful routes: Index GET /pokemon Show GET /pokemon/:id New GET /pokemon/new Edit GET /pokemon/:id/edit Create POST /pokemon Update PUT /pokemon/:id Destroy DELETE /pokemon/:idarrow_forwardModify the Lab 6 java applet that produces a Bulls Eye with six concentric circles usingtwo colors as shown below. The applet should include a method that creates anddisplays a filled circle. The for loop should be modified to use the method. (See pg. 376,Programming Project 11, Savitch).The fillCircle method can be placed above or below the paint method and should bedefined using the following:private void fillCircle (Graphics canvas, int X, int Y, int diameter, Color color){canvas.setColor(color);canvas.fillOval(X, Y, diameter, diameter);}The program should continue to use Named Constants to establish and maintain the xand y settings for the circles and the amount to change the diameter for each circle.Use a for loop to control the drawing of each of the 6 circles. Within the loop, increasethe x, y settings; reduce the diameter for the new circle; and alternate the colors whencalling the drawCircle method. Test your code using the AppletViewer.Sample using AppletViewarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education