Class ExtrudeCmd
java.lang.Object
com.j3d.engine.interact.cmd.base.Command
com.j3d.engine.interact.cmd.commands.ExtrudeCmd
- All Implemented Interfaces:
KeyedStatefulCommand,SemiStatefulCommand,StatefulCommand<Void>
A command to extrude a selected
GTri (triangle) along its normal vector.
This command allows the user to interactively adjust the extrusion length and direction of a single selected triangle. A visual ghost of the extruded shape is displayed during the process.
Users can commit the extrusion with 'Enter' or cancel with 'Escape'. The extrusion length can be adjusted using the 'Up' and 'Down' arrow keys. The direction of extrusion (flipped along the normal) can be toggled using the 'Left' and 'Right' arrow keys. A "gear" system, activated by the 'R' key, controls the step size of length adjustments.
Typical Usage:
// Select a single triangle first, then run the command
extrude
// Or specify the triangle directly by its UUID
extrude a7e58b1c-2d3f-4a5b-6c7d-8e9f0a1b2c3d
- Author:
- Lehlogonolo Poole
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe index of the currently active step size in the gearTrain.(package private) booleanprotected J3KeyThe keybinding used to cycle through the gearTrain step sizes.protected double[]An array of step sizes (e.g., 1, 5, 20) that the user can cycle through.A list of temporary keybindings (e.g., arrow keys) active during this state.(package private) double(package private) UUIDprotected GTriFields inherited from class com.j3d.engine.interact.cmd.base.Command
aliases, args, description, usages -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfinished(boolean success, SafeJLabel label) Method which clears all state related to this which can be keys ghost previews temporary listeners ...intGets the index of the currently active step size in the gear train.double[]Gets the array of available step sizes for the transformation (the "gear train").getKeys()Gets the list of temporaryJ3Keys that are active during this command's state.private voidghost(Graphics2D graphics2D) private voidjoin()voidonEnter(Void object, SafeJLabel label) Called when the 'Enter' key is pressed.voidonEsc(Void object, SafeJLabel label) Called when the 'Escape' key is pressed.voidonStart(Void object, SafeJLabel label) Called when the command is first started.voidrun(Invoker invoker, SafeJLabel logLabel, String aliasUsed, Object[] args, ArrayList<TaggedArgValue<?>> taggedArgs) The method to be overridden by subclasses to implement command functionality.selfName()Returns the name of the specific command instance, used for creating unique key IDs.voidsetGearIndex(int index) Sets the current gear index, allowing the command to cycle through step sizes.Methods inherited from class com.j3d.engine.interact.cmd.base.Command
addNoArgUsage, aliases, aliasStream, args, dispatchToSubcommands, getUsages, hasNoArgs, parseUsages, usages, varTaggedArgsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.j3d.engine.interact.cmd.base.KeyedStatefulCommand
newGearKey, setDownKey, setKey, setKeyAsSideEffects, setLeftKey, setRightKey, setUpKeyMethods inherited from interface com.j3d.engine.interact.cmd.base.SemiStatefulCommand
fireMethods inherited from interface com.j3d.engine.interact.cmd.base.StatefulCommand
run, run
-
Field Details
-
gearTrain
protected double[] gearTrainAn array of step sizes (e.g., 1, 5, 20) that the user can cycle through. -
currentIndex
protected int currentIndexThe index of the currently active step size in the gearTrain. -
gear
The keybinding used to cycle through the gearTrain step sizes. -
keys
A list of temporary keybindings (e.g., arrow keys) active during this state. -
tri
-
length
double length -
flipped
boolean flipped -
overlapId
UUID overlapId
-
-
Constructor Details
-
ExtrudeCmd
public ExtrudeCmd()
-
-
Method Details
-
run
public void run(Invoker invoker, SafeJLabel logLabel, String aliasUsed, Object[] args, ArrayList<TaggedArgValue<?>> taggedArgs) Description copied from class:CommandThe method to be overridden by subclasses to implement command functionality. -
onStart
Description copied from interface:StatefulCommandCalled when the command is first started.- Specified by:
onStartin interfaceStatefulCommand<Void>- Parameters:
object- The object that the command operates on.label- The SafeJLabel instance.
-
ghost
-
getAllPoints
-
join
private void join() -
onEnter
Description copied from interface:StatefulCommandCalled when the 'Enter' key is pressed.- Specified by:
onEnterin interfaceStatefulCommand<Void>- Parameters:
object- The object that the command operates on.label- The SafeJLabel instance.
-
onEsc
Description copied from interface:StatefulCommandCalled when the 'Escape' key is pressed.- Specified by:
onEscin interfaceStatefulCommand<Void>- Parameters:
object- The object that the command operates on.label- The SafeJLabel instance.
-
finished
Description copied from interface:KeyedStatefulCommandMethod which clears all state related to this which can be- keys
- ghost previews
- temporary listeners
- ...
- Specified by:
finishedin interfaceKeyedStatefulCommand- Parameters:
success- Whether the command finished successfully or not. if the user had clicked escape or an error occurred that counts as an unsuccessful invocationlabel- The label.
-
getKeys
Description copied from interface:KeyedStatefulCommandGets the list of temporaryJ3Keys that are active during this command's state.- Specified by:
getKeysin interfaceKeyedStatefulCommand- Returns:
- An
ArrayListof active keys.
-
selfName
Description copied from interface:KeyedStatefulCommandReturns the name of the specific command instance, used for creating unique key IDs.- Specified by:
selfNamein interfaceKeyedStatefulCommand- Returns:
- The name of the command.
-
getGearTrain
public double[] getGearTrain()Description copied from interface:KeyedStatefulCommandGets the array of available step sizes for the transformation (the "gear train").- Specified by:
getGearTrainin interfaceKeyedStatefulCommand- Returns:
- An array of doubles representing different step magnitudes.
-
getGearIndex
public int getGearIndex()Description copied from interface:KeyedStatefulCommandGets the index of the currently active step size in the gear train.- Specified by:
getGearIndexin interfaceKeyedStatefulCommand- Returns:
- The current gear index.
-
setGearIndex
public void setGearIndex(int index) Description copied from interface:KeyedStatefulCommandSets the current gear index, allowing the command to cycle through step sizes.- Specified by:
setGearIndexin interfaceKeyedStatefulCommand- Parameters:
index- The new gear index.
-