Is the variable "width" not defined?

I’m reading this piece of code and somehow I’m confused. I can not find the definition of “width” anywhere…

////// MAIN INPUTS ///////
String directoryName = "${DIRECTORY_NAME}";  // directory name
String date = "${DATE}";     // today's date
String inputFile = "../data/output.csv";  // the main csv file which drives the animation
int totalFrames = ${TOTAL_FRAMES};  // the total number of frames, which is 3600
Location center = new Location(${AVG_LAT}, ${AVG_LON}); // the center location of the map
Integer zoom_start = 9;                       ///////////////////////////////////////////////////////////
String date_format = "M/d/yy";
String day_format = "EEEE";                   ///////////////////////////////////////////////////////////
String time_format = "h:mm a";
boolean recording = ${RECORDING};
boolean HQ = false;                           ///////////////////////////////////////////////////////////
boolean rotateBearing = true;                 ///////////////////////////////////////////////////////////

// Import Unfolding Maps
import de.fhpotsdam.unfolding.*;
import de.fhpotsdam.unfolding.core.*;
import de.fhpotsdam.unfolding.geo.*;
import de.fhpotsdam.unfolding.interactions.*;
import de.fhpotsdam.unfolding.mapdisplay.*;
import de.fhpotsdam.unfolding.mapdisplay.shaders.*;
import de.fhpotsdam.unfolding.marker.*;
import de.fhpotsdam.unfolding.providers.*;
import de.fhpotsdam.unfolding.texture.*;
import de.fhpotsdam.unfolding.tiles.*;
import de.fhpotsdam.unfolding.ui.*;
import de.fhpotsdam.unfolding.utils.*;
import de.fhpotsdam.utils.*;

// Import some Java utilities
import java.util.Date;
import java.text.SimpleDateFormat;

// Import video export
import com.hamoid.*;
VideoExport videoExport;

// Declare Global Variables

UnfoldingMap map;

// Statistics input files (for stacked area chart)
String vehicleCountFile = "../data/vehicle_counts/vehicles_" + totalFrames + ".csv";
String busCountFile = "../data/vehicle_counts/buses_" + totalFrames + ".csv";
String tramCountFile = "../data/vehicle_counts/trams_" + totalFrames + ".csv";
String cablecarCountFile = "../data/vehicle_counts/cablecars_" + totalFrames + ".csv";
String metroCountFile = "../data/vehicle_counts/metros_" + totalFrames + ".csv";
String trainCountFile = "../data/vehicle_counts/trains_" + totalFrames + ".csv";
String ferryCountFile = "../data/vehicle_counts/ferries_" + totalFrames + ".csv";

int totalSeconds;
Table tripTable;

ArrayList<Trips> trips = new ArrayList<Trips>();
ArrayList<String> operators = new ArrayList<String>();
ArrayList<String> vehicle_types = new ArrayList<String>();
ArrayList<Float> bearings = new ArrayList<Float>();

Table vehicleCount;
IntList vehicleCounts;                                         //////////////////////////////////////////////////////////////////
int maxVehicleCount;
float hscale = float(totalFrames) / float(width)*0.12;
1 Like

Usually, “width” is the actual width of the window you set with size(). I don’t know if that library you’re using changes this… :sweat_smile:
Could be that I just don’t understand what you’re asking for :sweat_smile: In that case, sorry xD


width is pre-defined variable that is in-build with processing and does not have to be declared

It’s similar to mouseX, it’s just there

But you can only access it properly after size() by the way…


If you find a variable or method that you don’t see defined, it is usually a built-in part of either Processing or Java.

Most built-in parts of Processing are listed in the reference – e.g. search the reference page for “width”: