Sample

Schnappinger/aoi/artofillusion.animation.distortion.CustomDistortion

Human rating uses the original dataset scale.

Human2.99
Lines114

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
31.1Δ 7.7
Scalabrino0.3850–1; higher is more readable
3.8Δ 19.7
Dorn0.190–1; higher is more readable
40.3Δ 16.8
Mi0.4010–1; higher is more readable
24.8Δ 1.3
LLOC68Logical lines; fewer is more readable
30.7Δ 7.3
DeepSeek V4 Pro14.330–20; mean of three runs
32.3Δ 8.9
GPT-6.1 Sol160–20; mean of three runs
38.9Δ 15.5
BTTF0.3550–1; higher is more readable
28.4Δ 5.0
Human2.991–4; original rating
23.4

Views

Source code

/* Copyright (C) 2002-2012 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.animation.distortion; import artofillusion.math.*; import artofillusion.procedural.*; import artofillusion.object.*; /** This is a distortion which uses a procedure to distort an object. */ public class CustomDistortion extends Distortion { private Procedure proc; private int procVersion; PointInfo point; private double weight; private Mat4 preTransform, postTransform; public CustomDistortion(Procedure proc, int procVersion, PointInfo point, double weight, Mat4 preTransform, Mat4 postTransform) { this.proc = proc; this.procVersion = procVersion; this.point = point; this.weight = weight; this.preTransform = preTransform; this.postTransform = postTransform; } /** Determine whether this distortion is identical to another one. */ public boolean isIdenticalTo(Distortion d) { if (!(d instanceof CustomDistortion)) return false; CustomDistortion s = (CustomDistortion) d; if (previous != null && !previous.isIdenticalTo(s.previous)) return false; if (previous == null && s.previous != null) return false; if (weight != s.weight || proc != s.proc || procVersion != s.procVersion) return false; if (point.t != s.point.t) return false; if (point.param == null) { if (s.point.param != null) return false; } else { if (s.point.param == null || point.param.length != s.point.param.length) return false; for (int i = 0; i < point.param.length; i++) if (point.param[i] != s.point.param[i]) return false; } if (preTransform == s.preTransform && postTransform == s.postTransform) return true; return (preTransform != null && preTransform.equals(s.preTransform) && postTransform != null && postTransform.equals(s.postTransform)); } /** Create a duplicate of this object. */ public Distortion duplicate() { CustomDistortion d = new CustomDistortion(proc, procVersion, point, weight, preTransform, postTransform); if (previous != null) d.previous = previous.duplicate(); return d; } /** Apply the Distortion, and return a transformed mesh. */ public Mesh transform(Mesh obj) { if (previous != null) obj = previous.transform(obj); Mesh newmesh = (Mesh) obj.duplicate(); MeshVertex[] vert = newmesh.getVertices(); Vec3 newvert[] = new Vec3 [vert.length]; OutputModule output[] = proc.getOutputModules(); double w2 = 1.0-weight; for (int i = 0; i < newvert.length; i++) { newvert[i] = vert[i].r; if (preTransform != null) preTransform.transform(newvert[i]); point.x = newvert[i].x; point.y = newvert[i].y; point.z = newvert[i].z; proc.initForPoint(point); if (output[0].inputConnected(0)) newvert[i].x = weight*output[0].getAverageValue(0, 0.0) + w2*newvert[i].x; if (output[1].inputConnected(0)) newvert[i].y = weight*output[1].getAverageValue(0, 0.0) + w2*newvert[i].y; if (output[2].inputConnected(0)) newvert[i].z = weight*output[2].getAverageValue(0, 0.0) + w2*newvert[i].z; if (postTransform != null) postTransform.transform(newvert[i]); } newmesh.setVertexPositions(newvert); return newmesh; } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.4664.347−153.923
Source linesThe number of non-empty source lines.114+45.6
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.743−7.115

Intercept 8.87 + feature contributions = -106.568 (log-odds).
Score = sigmoid(-106.568) = 0.

Score0.385

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.114−3
Indentation frequencyHow rapidly indentation changes from line to line.106+2.929
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.106−2.012
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.128.982−1.798
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.128.991+1.277
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.112.754+1.166
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.106−0.086

Intercept 0.07 + feature contributions = -1.453 (log-odds).
Score = sigmoid(-1.453) = 0.19.

Score0.401
Score68
Run 1

The code has clear structure with logical method separation and a readable copyright header. The constructor and duplicate() method are straightforward. However, isIdenticalTo() contains deep nesting and duplicated null-checking logic that could be simplified, reducing readability. The transform() method is mostly clear but mixes multiple actions per line in several assignments, lowering action granularity. Variable names like 'w2' and 'proc' are terse but acceptable. Overall, the code is understandable but has moderate complexity in comparisons and some dense lines.

Run 2

The code is generally readable with clear naming, logical class structure, and straightforward methods. However, several issues reduce readability. The `isIdenticalTo` method is long and deeply nested, with null-checking logic that interrupts flow. The `transform` method mixes multiple operations per line (e.g., weighted value calculations) and has a dense loop body. The use of `output[0]`, `output[1]`, `output[2]` lacks descriptive indexing. Some magic numbers (e.g., `0.0`, `1.0`) and repeated null-check patterns could be extracted. While the overall intent is clear, the code would benefit from refactoring to reduce nesting and improve action granularity.

Run 3

The code has a clear class structure with organized methods for comparison, duplication, and transformation. However, readability is reduced by the deeply nested and verbose isIdenticalTo method, which contains multiple if-else blocks and a loop inside a nested branch. The transform method is relatively flat but contains several similar operations that could be extracted into a helper. Variable names like 'w2' and 's' are unclear, and null-check branching adds cognitive load. Action granularity is mostly one action per line, and intent is generally understandable, but the overall flow could be improved by simplifying conditional logic and reducing repetition.

Run 1

Code Structure: Clearly separated constructor, comparison, duplication, and transformation methods provide logical organization. Nesting: Mostly shallow, with early returns reducing complexity; parameter comparison adds moderate nesting. Clarity of intent: Method comments and descriptive fields explain the purpose, but abbreviated locals such as s, d, vert, and w2, plus unexplained output indices, require interpretation. Code length: Reasonably concise, although coordinate updates repeat similar logic and equality checking is somewhat verbose. Action granularity: Statements generally perform one action per line, making state changes easy to follow. Reading flow: Transformation proceeds naturally from duplication through per-vertex processing to returning the mesh. Unusual brace indentation, inconsistent array declaration styles, omitted conditional braces, and tightly spaced arithmetic slightly disrupt readability.

Run 2

Code Structure: The class is logically organized into initialization, equality checking, duplication, and mesh transformation. Nesting: Early returns keep comparisons relatively flat; parameter checks and the vertex loop introduce only moderate nesting. Clarity of intent: Method names and brief documentation explain the purpose, but abbreviated variables such as s, d, vert, and w2, implicit output-index meanings, and shared mutable point state require interpretation. Code length: Generally concise, although repetitive coordinate updates and manual parameter comparisons add some verbosity. Action granularity: Statements mostly perform one action per line, making execution easy to follow. Reading flow: Transformation steps progress naturally from duplication through pre-transformation, procedural evaluation, blending, and post-transformation. Unconventional brace indentation, inconsistent array declaration styles, omitted conditional braces, and tightly spaced arithmetic slightly reduce readability.

Run 3

Code Structure: The class is logically divided into construction, equality checking, duplication, and transformation, with helpful method comments. Nesting: Mostly shallow; early returns keep equality checks manageable, though parameter comparison adds some nesting. Clarity of intent: Method names and the transformation sequence communicate purpose well, but abbreviated variables such as s, d, vert, and w2, plus unexplained output indices, require interpretation. Code length: Reasonably concise, although repeated coordinate calculations and detailed equality checks could benefit from small helper methods. Action granularity: Statements generally perform one action per line; compound conditions remain understandable. Reading flow: Execution proceeds naturally from prior distortion through mesh duplication, vertex processing, and result assignment. Inconsistent array declaration styles, unusual brace indentation, omitted braces around conditional bodies, and tight operator spacing slightly reduce scanability.