محاسبه مساحت و محیط دایرهها
Contents
[
Hide
]چگونه مساحت و محیط دایرهها را محاسبه کنیم
مسئله: چگونه مساحت و محیط دایرهها را محاسبه کنیم (CADNET-1153).
نکات: برای این کار، شعاع را از CadEntityTypeName.CIRCLE از موجودیتها دریافت کرده و از فرمول “2 * Math.PI * radius” استفاده کنید.
مثال:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach (CadBaseEntity entity in cadImage.Entities) | |
{ | |
if (entity.TypeName == CadEntityTypeName.CIRCLE) | |
{ | |
double radius = ((CadCircle)entity).Radius; | |
System.Console.WriteLine("Circumference= " + 2 * Math.PI * radius); | |
System.Console.WriteLine("Area= " + Math.PI * radius * radius); | |
} | |
} |