Sample

Schnappinger/aoi/artofillusion.material.MaterialMapping

Human rating uses the original dataset scale.

Human3.96
Lines121

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett10–1; higher is more readable
92.0Δ 10.1
Scalabrino0.9360–1; higher is more readable
95.9Δ 14.0
Dorn0.7430–1; higher is more readable
78.9Δ 3.0
Mi0.5990–1; higher is more readable
62.4Δ 19.5
LLOC24Logical lines; fewer is more readable
54.3Δ 27.6
DeepSeek V4 Pro17.670–20; mean of three runs
83.0Δ 1.2
GPT-6.1 Sol180–20; mean of three runs
73.8Δ 8.1
BTTF0.6840–1; higher is more readable
75.9Δ 5.9
Human3.961–4; original rating
81.8

Views

Source code

/* Copyright (C) 2000-2007 by Peter Eastman This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ package artofillusion.material; import artofillusion.*; import artofillusion.math.*; import artofillusion.object.*; import buoy.widget.*; import java.io.*; /** A MaterialMapping describes the mapping of a Material's coordinates to the local coordinate system of an object. This is an abstract class. Its subclasses describe various types of mappings which are appropriate for various types of objects and materials. */ public abstract class MaterialMapping { Object3D object; Material material; protected MaterialMapping(Object3D obj, Material mat) { object = obj; material = mat; } /** Every subclass of MaterialMapping must define a constructor which takes a Material and an Object3D as its arguments: <p> public MappingSubclass(Object3D theObject, Material theMaterial) <p> In addition, every subclass must include a constructor with the signature <p> public MappingSubclass(DataInputStream in, Object3D theObject, Material theMaterial) throws IOException, InvalidObjectException <p> which reconstructs the mapping by reading its data from an input stream. The following method writes the object's data to an output stream. */ public abstract void writeToFile(DataOutputStream out) throws IOException; /** Get the name of this type of mapping. Subclasses should override this method to return an appropriate name. */ public static String getName() { return ""; } /** Get the index of refraction for this mapping's Material. */ public double indexOfRefraction() { return material.indexOfRefraction(); } /** Get the step size to use for integrating the material. */ public abstract double getStepSize(); /** Return true if this mapping's Material has internal scattering. */ public boolean isScattering() { return material.isScattering(); } /** Return true if this mapping's Material casts shadows. */ public boolean castsShadows() { return material.castsShadows(); } /** Get the Material which is being mapped. */ public Material getMaterial() { return material; } /** Get the object to which the material is applied. */ public Object3D getObject() { return object; } /** Given a point inside the object for which this mapping is being used, find the corresponding material properties. The properties should be averaged over a region of width size. */ public abstract void getMaterialSpec(Vec3 pos, MaterialSpec spec, double size, double t); /** Create a new MaterialMapping which is identical to this one. */ public abstract MaterialMapping duplicate(); /** Create a new MaterialMapping which is identical to this one, but for a different object and Material. */ public abstract MaterialMapping duplicate(Object3D obj, Material mat); /** Make this mapping identical to another one. */ public abstract void copy(MaterialMapping map); /** This method should return a Widget in which the user can edit the mapping. The parameters are the object whose mapping is being edited, and a MaterialPreviewer which should be rendered whenever one of the mapping's parameters changes. */ public abstract Widget getEditingPanel(Object3D obj, MaterialPreviewer preview); }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.121+48.4
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.1292.901−42.666
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.669−7.004

Intercept 8.87 + feature contributions = 7.601 (log-odds).
Score = sigmoid(7.601) = 1.

Score0.936

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.120−3.212
Indentation frequencyHow rapidly indentation changes from line to line.93+2.48
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.132.975−1.967
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.132.992+1.341
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.119.903+1.266
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.026+0.687
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398

Intercept 0.07 + feature contributions = 1.063 (log-odds).
Score = sigmoid(1.063) = 0.743.

Score0.599
Score24
Run 1

The code is highly readable due to its clear, logical structure and excellent documentation. The class is well-organized with related methods grouped together, and the abstract methods are clearly separated from concrete implementations. Nesting is essentially flat, with no complex conditional logic or deep indentation. Each method has a clear Javadoc comment explaining its purpose, and method names are descriptive, making intent immediately apparent. The code is concise without being overly terse, using appropriate abstraction and delegation to the material and object classes. Action granularity is excellent - each line performs a single, clear operation. Reading flow is natural, following a logical progression from constructors to file I/O, property getters, and abstract methods. The only minor deductions are for the empty default getName() method and abstract methods that could benefit from even more specific documentation about edge cases. Overall, this is exemplary Java code that prioritizes clarity and maintainability.

Run 2

The code is highly readable. The structure follows a clear, logical class definition with well-defined abstract methods and concise accessors. Nesting is minimal, with only one small if-like conditional (the Javadoc note), and the body of the class is flat. Clarity of intent is strong, as method names like indexOfRefraction, castsShadows, and getMaterialSpec clearly describe their purpose and are supported by descriptive Javadoc comments. Code length is appropriate, avoiding redundancy and unnecessary verbosity. Action granularity is mostly one action per line, especially in the accessor methods that simply return a field. Reading flow is natural: fields, constructor, then abstract and concrete methods grouped by purpose (file IO, naming, material properties, mapping behavior). Minor deductions: some lengthy Javadoc paragraphs and the static getName method with no obvious use slightly disrupt flow, but overall the code is exemplary for an abstract framework class.

Run 3

The code is highly readable. It starts with a clear license and package/import statements. The class declaration and Javadoc comments clearly state the purpose. Structure is logical, using blank lines and concise method declarations. Nesting is minimal, with no deeply nested logic. Each abstract method is documented with a clear purpose and the class maintains one action per line. The overall length is appropriate, avoiding unnecessary verbosity, and reading flow follows a natural order from initialization to utility methods.

Run 1

Code Structure: A well-organized abstract class separates initialization, material queries, mapping operations, and editing support. Nesting: Minimal nesting; concrete methods contain only simple assignments or returns. Clarity of intent: Descriptive method names and documentation clearly explain responsibilities, although the static getName() documentation misleadingly suggests overriding, and parameters such as t lack explanation. Code length: Implementation is concise, though extensive comments and blank lines add some reading overhead. Action granularity: Each statement performs a single action on its own line. Reading flow: Consistent formatting and method-level documentation make the class easy to scan; wildcard imports slightly obscure dependencies.

Run 2

Code Structure: The abstract class is logically organized around mapping state, material queries, duplication, serialization, and editing. Nesting: Methods are flat, with no nested control flow. Clarity of intent: Descriptive method names and extensive documentation make the API easy to understand; however, the comment about overriding static getName() is misleading, and parameters such as t are unexplained. Code length: Implementations are concise, though generous spacing and some lengthy comments slightly slow scanning. Action granularity: Each statement performs one clear action, and simple delegation methods are straightforward. Reading flow: Consistent formatting and method-level documentation support natural reading, although related methods could be grouped more explicitly and wildcard imports obscure dependencies.

Run 3

Code Structure: The abstract class cleanly groups mapping state, material accessors, and subclass contracts, though method ordering could be more cohesive. Nesting: Methods are flat and trivial, with no complex control flow. Clarity of intent: Descriptive names and documentation make the purpose clear; however, the instruction to override static getName() is misleading because static methods are hidden rather than overridden, and parameter t is undocumented. Code length: Implementation is concise, although extensive comments and blank lines add some bulk. Action granularity: Each statement occupies its own line, and concrete methods perform a single clear action. Reading flow: Consistent formatting and method-level documentation support easy scanning, with minor interruptions from lengthy constructor documentation and wildcard imports.