このjava.awt.geom
パッケージは、ベクターグラフィックスの操作に非常に便利に見えます。特に、この機能に興味があります。
public void add(Area rhs)
Adds the shape of the specified Area to the shape of this Area. The resulting shape of this Area will include the union of both shapes, or all areas that were contained in either this or the specified Area.
// Example:
Area a1 = new Area([triangle 0,0 => 8,0 => 0,8]);
Area a2 = new Area([triangle 0,0 => 8,0 => 8,8]);
a1.add(a2);
a1(before) + a2 = a1(after)
################ ################ ################
############## ############## ################
############ ############ ################
########## ########## ################
######## ######## ################
###### ###### ###### ######
#### #### #### ####
## ## ## ##
私はJavaに非常に慣れていないので、ばかげたことを尋ねている場合は許してください。ただし、コードをnetbeansに貼り付けると、triangle
どこかで宣言する必要があるというエラーが表示されます。この構文の性質は私にはわかりません。いくつか検索した後でも、どうすればよいかわかりません。